Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if( is_single() ):
- $linebreak = "\n";
- header('Content-type: text/plain; charset=utf-8');
- if (have_posts()):
- while( have_posts() ): the_post();
- $content = wptexturize($post->post_content);
- //Ensure there is plenty of space above and below headings so they stand out.
- $content = preg_replace('/(<h\d>)/i', "\n\n$1", $content);
- $content = preg_replace('/(<\/h\d>)/i', "$1\n\n", $content);
- the_title();
- echo $linebreak;
- echo 'Published ' . get_the_date();
- echo $linebreak;
- echo $linebreak;
- echo wordwrap( strip_tags($content), 80, $linebreak );
- echo $linebreak;
- echo $linebreak;
- echo 'HTML version available at ' . get_permalink($post->ID);
- endwhile;
- endif;
- endif;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment