WordPress.org

Support

Support » Themes and Templates » [Resolved] Excerpt "Read more" modifying

[Resolved] Excerpt "Read more" modifying

  • Hello!

    I have problems modifying Read More for excerpt.
    I have following code to display posts:

    <?php
    $args = array( 'numberposts' => 4,'post_type' => 'offers' );
    $lastposts = get_posts( $args );
    foreach($lastposts as $post) : setup_postdata($post); ?>
    <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    <?php the_excerpt(); ?>
    <?php endforeach; ?>

    And I am trying to use this filter:

    function custom_excerpt_more( $more ) {
    	return '[.....]';
    }
    add_filter( 'excerpt_more', 'custom_excerpt_more' );

    But nothing happens 🙁 Where’s a problem?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Have you enabled excerpt support for your “offers” custom post type?

    Yes, excerpt is displayed, but instead of “[…..]” I see “Continue reading →”

    What Theme are you using?

    Check functions.php to ensure that excerpt_more isn’t already being filtered.

    thank you Chip! I was using TwentyTen theme and this filter was already used 🙂 so lame..

    thank you Chip! I was using TwentyTen theme and this filter was already used 🙂 so lame..

    In that case, it’s easy to override, by passing a higher priority. I assume the Twenty Ten filter uses the default priority (10), so try passing a priority of 11:

    add_filter( 'excerpt_more', 'custom_excerpt_more', 11 );
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Excerpt "Read more" modifying’ is closed to new replies.
Skip to toolbar