Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //'excerpt' for pages//alchymyth 2011//fix for pages with <!--nextpage--> //
- if( $numpages >1 || end(explode('/',get_permalink($post->ID))) == end(explode('/',wp_get_referer())) ) :
- the_content();
- else :
- $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_filters('the_content', $text);
- echo $text;
- echo '<a href="' . get_permalink($post->ID) . '">continue reading...</a>';
- endif; ?>
Add Comment
Please, Sign In to add comment