Once again my amature php skills have me pinned down by its strings!
I am trying to change the excerpt length of the post summaries on my WordPress blog page. So far I have created a child theme, replaces the content.php file code to
<div class="entry-content">
<?php the_excerpt( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
and added a functions file with the following code
<?php
function CHILDTHEME_excerpt_length($length) {
return 600;
}
add_filter('excerpt_length', 'CHILDTHEME_excerpt_length'); ?>
AND what do you know…… It still remains the same length of summary on the blog page as before. What am I doing wrong?
All help is very much appreciated as always
You must set the filter priority right:
Without specifying the priority WordPress filter on this function will run last and override what you set here.
You probably have a filter that is running after yours and resetting the length. You can set a higher priority, this can be guesswork until you get it high enough. Another option is to remove all the existing filters for this hook before you add yours: