Posted By

webtechdev on 04/29/12


Tagged


Versions (?)

the_except() remove [...] or add any custom words


 / Published in: PHP
 

You can just re-write the excerpt function in your theme functions file... ust change this line...

array_push($words, '[...]');

You can also change the character limit here...

$excerptlength = applyfilters('excerpt_length', 55);

  1. function wp_new_excerpt($text)
  2. {
  3. if ($text == '')
  4. {
  5. $text = get_the_content('');
  6. $text = strip_shortcodes( $text );
  7. $text = apply_filters('the_content', $text);
  8. $text = str_replace(']]>', ']]>', $text);
  9. $text = strip_tags($text);
  10. $text = nl2br($text);
  11. $excerpt_length = apply_filters('excerpt_length', 55);
  12. $words = explode(' ', $text, $excerpt_length + 1);
  13. if (count($words) > $excerpt_length) {
  14. array_pop($words);
  15. array_push($words, '[...]');
  16. $text = implode(' ', $words);
  17. }
  18. }
  19. return $text;
  20. }
  21. remove_filter('get_the_excerpt', 'wp_trim_excerpt');
  22. add_filter('get_the_excerpt', 'wp_new_excerpt');

Report this snippet  

You need to login to post a comment.