Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- instead of:
- <?php the_content(); ?>
- try and use (partly adapted from 'wp_trim_excerpt()' ):
- <?php
- $length = 120; //set length in words
- $text = get_the_content('');
- $text = apply_filters('the_content', $text);
- $text = str_replace(']]>', ']]>', $text);
- $text = strip_shortcodes( $text );
- $text = strip_tags($text);
- $words = explode(' ', $text, $length+1 );
- if (count($words)> $length) {
- array_pop($words);
- $text = implode(' ', $words);
- } else {
- $text = implode(' ', $words);
- }
- $text = apply_filter('the_content', $text);
- echo $text;
- echo '<a href="' . get_permalink($post->ID) . '">continue reading...</a>';
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement