GeneratePress doesn’t have built-in breadcrumbs. However, it is easy to add breadcrumbs from a third party plugin using hooks.
We will use Yoast SEO for the examples below but the method should apply to any breadcrumb plugins.
Using Hooks Element
If you have GP Premium, the easiest method is to use our Hooks Element.
- Go to Appearance > Elements. Click Add New and select Hook to create a new hook element.
- Add the shortcode provided by Yoast.
- In the Hook dropdown list, select the desire location for the breadcrumbs to show using the visual guide. The usual option is the
generate_before_entry_title
hook. - Make sure Execute Shortcodes checkbox is checked.
- Go to Display Rules tab and select Post under the Location dropdown list.
After this hook element is published, the breadcrumbs should now display in posts.
Using Functions
If you don’t have GP Premium, then the PHP snippet below is required to display breadcrumbs.
add_action( 'generate_after_header', function() {
if ( function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb( '<div class="grid-container grid-parent"><p id="breadcrumbs">','</p></div>' );
}
} );
You can move the breadcrumbs by replacing generate_after_header
with the desired hook using this visual guide.