Different lengths for Excerpt in different locations
-
Hello
I have a home page that takes excerpts from pages for certain parts and it also pulls in the latest news post in another part of the page.
I want to have the three widgets with page excerpts having a certain length e.g. 41 words
and the latest news post excerpt to have a different amount like 200 words.
I have tried the following:
function excerpt_length_category( $length ) { if (in_category( 'News' )) { return 200; } else { return 41; } } add_filter( 'excerpt_length', 'excerpt_length_category' );
(added it to my functions.php file but it hasn’t made any difference and every excerpt is at 41. I’ve cleared caches etc.
Any ideas?
I’m using a child theme based on Spacious WordPress theme.
Thanks in advance for any ideas
Vicky
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘Different lengths for Excerpt in different locations’ is closed to new replies.