Discover in this tutorial how to modify the breadcrumbs in a Genesis child theme using code.
In a previous tutorial you saw how to change the text (and separator) that appears on archive pages.
But the filter we used in that case does not allow you to customize breadcrumbs in other locations, such as in categories, author pages, searches…
So, in this tutorial we are going to see how you can customize all of them.
Snippet to customize breadcrumbs in a Genesis child theme
First of all, make sure you have breadcrumbs enabled for the pages where you want them to be displayed. You can do this from the WordPress customizer under Theme Settings > Breadcrumbs:
These are all the arguments you can customize in the genesis_breadcrumb_args
filter:
To see this and another 1097 code snippets of this website, login or subscribe here.
You see you can customize quite a few arguments:
- The initial text
- The separator
- Subsequent text
- The text that appears in
- Author archive pages
- Tag archive pages
- Category archive pages
- Date archive pages
- CPT archive pages
- Search pages
- Page 404
You can modify the text of each of them to your liking.
If you only want to modify one of them, just include that argument. For example, if you want to modify the breadcrumb for the search pages you will need to add the following snippet at the end of the functions.php file:
To see this and another 1097 code snippets of this website, login or subscribe here.
Conclusion
As you can see, with a few lines of code you can modify the breadcrumbs in a Genesis child theme to your liking.
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. 🙂