Adding Breadcrumbs

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.

  1. Go to Appearance > Elements. Click Add New and select Hook to create a new hook element.
  2. Add the shortcode provided by Yoast in this article:
    https://kb.yoast.com/kb/implement-wordpress-seo-breadcrumbs/
  3. In the Hook dropdown list, select the desire location for the breadcrumbs to show using the visual guide. The usual option is the before_entry_title hook.
  4. Make sure Execute Shortcodes checkbox is checked.
  5. 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.