Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The topic ‘Blogpost excerpt length depending on category’ is closed to new replies.
Hi there,
i created two categories on my website for blogposts. Category 1: “Post with image”, Category 2: “Post without image”.
I would like to change the excerpt length of this blogpost depending on the category. How would i do that?
I found this code:
“add_filter(‘avf_postgrid_excerpt_length’,’avf_postgrid_excerpt_length_mod’, 10, 1);
function avf_postgrid_excerpt_length_mod($length) {
if ( in_category( ‘3’ ) ) {
return 160;
} else {
return 10;
}
}”
but it doesnt work. Any ideas?
Hey Pixel_Production,
Thank you for using Enfold.
Replace in_category with the is_category function instead. More info here.
// https://developer.wordpress.org/reference/functions/is_category/
Best regards,
Ismael
hi ismael,
thanks. found another solution by editing the postslider.php itself.
“$excerpt_length = !empty($thumbnail) ? 160 : 600;” if anyone else is interested. ;)
Hi,
Great, glad you found a solution and thanks for sharing. Much appreciated :-)
Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
Rikard
top support as always! topic can be closed. ;)