I've been googling this with no result.
I have a bunch of posts. But all of them does not have a featured image. So I was thinking it would look much nicer if all posts still had the same height.
Is it possible to display a longer excerpt if there is no featured image in the post?
Okey so this is what the code looks like now:
/**
* Set the post excerpt length to 40 words.
* @param int $length The number of excerpt characters.
* @return int The filtered number of characters.
*/
function twentyeleven_excerpt_length( $length ) {
return 40;
}
add_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
Maybe some sort of if statement could do the trick? You know:
if (featuredimage = true) {
function twentyeleven_excerpt_length( $length ) {
return 40;
}
add_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );
}
else {function twentyeleven_excerpt_length( $length ) {
return 80;
}
add_filter( 'excerpt_length', 'twentyeleven_excerpt_length' );}
As you can see I am a total newbie at this so I need some guidance.