prettyfly
prettyfly

Reputation: 3130

Wordpress: Removing the "Read More" link from a custom excerpt function?

Just a quicky here, I've created a function to limit the excerpt length for a specific post-type only (as I am having the excerpt for that specific post type show in a fading slider only) using the following function:

function client_excerpt($length) {
global $post;
    if ($post->post_type == 'testimonial')
         return 20;
    else
         return 55;
}
add_filter('excerpt_length', 'client_excerpt');

Now, that works just fine when I call get_the_excerpt within the loop outputting my div's for the slider. However, I don't want the "Read More..." link to appear on those excerpt's only. Can I stop them showing on those specific excerpts within my function?

Upvotes: 3

Views: 7355

Answers (1)

ChrisLTD
ChrisLTD

Reputation: 433

Try this, using the excerpt_more filter:

function new_excerpt_more( $more ) {
  global $post;
  if ($post->post_type == 'testimonial'){
    return '';
  }
}
add_filter('excerpt_more', 'new_excerpt_more');

Upvotes: 4

Related Questions