Find out how to customize the length of the extract or excerpt in the archive pages of any Genesis Framework child theme using code.
Genesis allows you to choose whether to show the entire contents of the entries or just a portion of them in the archive pages.
By default, the first 50 words of the post are displayed, but you can easily change this number by using a Genesis filter.
This can be very interesting when your archive page layout “asks” for more or less text to accompany the featured images.
Code snippet to set the length of the extract
Add this snippet at the end of the functions.php file:
To see this and another 917 code snippets of this website, login or subscribe here.
With this fragment, you limit the number of words that appear in the excerpt to the first 25.
If you prefer to control the number of characters instead of words, you can use the following code:
To see this and another 917 code snippets of this website, login or subscribe here.
With this you limit the extract to 155 characters. In this way you match the length of the excerpt with the meta description shown by Google.
With this snippet you also make sure that you don’t cut off the last word.
Of course, you can modify it according to your needs.
If you want to further customize this area, take a look at how to add a link next to the excerpt or insert a button below it.
Conclusions
Now you know the code to customize the excerpt length in the archive pages of any Genesis child theme.
If you have any question, please leave it in the comments. And if you want to give me a suggestion for future snippets, please send it through the contact form.
Benefits of being a subscriber. 🙂