Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I use two custom functions for my excerpts, the first modifies the length of the excerpt and the second allows me to use the_excerpt in two ways - with a read more link and without as long as the appropriate code is included while calling the_excerpt (see here).

When I use the traditional the_excerpt it generates three ellipses in brackets after it [...] - how do I remove these brackets and ellipses to just display the_excerpt itself without any link when calling it in posts, but still using my code below for the read more link elsewhere?

// Excerpt
    // Changing excerpt length
    function new_excerpt_length($length) {
        return 25;
    }
    add_filter('excerpt_length', 'new_excerpt_length');

    // Changing excerpt more
    function new_excerpt_more($post) {
      remove_filter('excerpt_more', 'new_excerpt_more'); 
      return ' <a class="read_more" href="'. get_permalink($post->ID) . '">' . 'read more' . '</a>';
    }
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

You haven't added the second filter, at least not in the code posted. If used, that filter will not print ellipses.

// Changing excerpt more
function new_excerpt_more($more) {
  global $post;
  remove_filter('excerpt_more', 'new_excerpt_more'); 
  return ' <a class="read_more" href="'. get_permalink($post->ID) . '">' . 'read more' . '</a>';
}
add_filter('excerpt_more','new_excerpt_more');

Notice the couple of changes I made to that function.

If you just want to strip the ellipses:

add_filter('excerpt_more','__return_false');
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.