I'm doing this inside Thesis 2, in case that matters.

I am using the_excerpt(); on my blog page to get the posts. And I'm using two custom filters:

function custom_excerpt_length( $length ) {
    if (is_page(5)){
    return 19;
    } else{
    return 120; 
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

function new_excerpt_more($more) {
    global $post;
    return '... <a href="'. get_permalink($post->ID) . '">more</a>';
add_filter('excerpt_more', 'new_excerpt_more');

The custom excerpt_more runs correctly unless there is a <!--more--> tag in the post. In that case, it displays the post up to that point, rather than the 120 word length set above (which is what I like) BUT... it doesn't display the custom excerpt_more and I don't know why.

Any help would be much appreciated.

  • If you are using the_excerpt(), do you still need to use the <!--more--> tag in your posts? – gdaniel May 15 '13 at 13:01
  • This is for a client and they already have many posts some with and without more, and I like the control it gives them, but this just gave me an idea, going to check... – Sam May 15 '13 at 14:23
  • Backup your MySQl DB, and then run a query to find and replace the more tag with nothing. – gdaniel May 15 '13 at 14:26
  • My idea manually filling in the excerpt box, and removing the more doesn't work either. – Sam May 15 '13 at 14:31
  • @gdaniel, Removing the more tags isn't my issue. I want the client to have control over whether they want the 120 word automatic excerpt or their own, more-tag-controlled excerpt. The problem is that when the excerpt is their's the custom 'excerpt_more' does not appear. – Sam May 15 '13 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.