The PHP code in this free quick tip enables you to conditionally change the length of the excerpt.
Based on this question from a member of the Genesis community :
Looking to change the excerpt length. I’d like to have it as an if page id is this return x, else be x so the homepage can be different.
Here’s the code for your child themes functions.php file :
In the above example, the excerpt length will be set at 10 words if the post is in the travel category otherwise the excerpt length for all other posts is set at 100 words.
This code includes a ternary operator and conditional tag.
You will need to swap out the conditional tag with your own to suit your own requirements.
Assumes you have set excerpts in Genesis > Theme Settings > Content Archives.
Was This Tutorial Helpful?