How do you add a custom excerpt length in twenty eleven child theme?
I have a problem displaying custom excerpt length. I've searched for a solution on wordpress stackexchange and found this:
remove_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
add_filter('excerpt_length', 'new_excerpt_length');
function new_excerpt_length($length) {
return 50;
}
When adding this to functions.php I still get the same 3 line excerpt as before. If I change the return statement to something else like, return 8 or return 17, I still get the same excerpt as before.
The excerpt function is inserted into content.php like this:
div class="entry-content"
?php the_excerpt(); ?
?php wp_link_pages( array( 'before' = 'div class="page-link"span' . __( 'Pages:', 'twentyeleven' ) . '/span', 'after' = '/div' ) ); ?
/div!-- .entry-content --
?php endif; ?
What am I doing wrong here?
Topic theme-twenty-eleven excerpt Wordpress
Category Web