s0what
Member
Posted 10 months ago #
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?
Have you enabled excerpt support for your "offers" custom post type?
s0what
Member
Posted 10 months ago #
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.
s0what
Member
Posted 10 months ago #
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 );