How To Add Yoast Breadcrumbs To The GeneratePress Theme

Need to enable breadcrumbs in the GeneratePress theme?

I’m using the GeneratePress theme (the premium version) and of course the Yoast SEO plugin. GeneratePress is quite frankly hands down the best WordPress theme I’ve ever come across.

I’ll probably be reviewing it at some point as I think it’s that good! Anyways, the one thing GeneratePress doesn’t show is breadcrumbs, in particular, Yoast SEO ones.

I searched through the forums

Which are a great source of info, with lots and tips and tutorials, etc.

Really for my reference more than anything I decided to collate the information here on LyrWP for others who may want to know how to add Yoast SEO breadcrumbs to the GeneratePress theme.

You’ll see right at the very top of this how-to article, my breadcrumbs working.

This is what we are aiming for, and this is what I will help you achieve. Let’s get started with my quick tutorial; it shouldn’t take you any longer than 15 minutes, probably a lot less.

You also don’t have to be an expert with anything, it’s a simple cut and paste job. So don’t worry it’s not complicated at all!

So how do you add Yoast SEO breadcrumbs to the GeneratePress theme?

We don’t need any additional plugins or anything like that; it’s super easy to do. I’ll guide you through it.

  1. First, head to the back end of your website to > appearance > elements.

    Once you’re in the Elements section, click add new. You will be greeted with the screen below:Add a new element

  2. From the Element, type choose a hook

    Choosing hook from the Element type will through up the below image. We’re going to hook into the theme to display our breadcrumbs.Choosing Hook element

  3. Give the Element a title, in this case, breadcrumbs (or whatever you like)

    Once you have done that, we need to add some code to the box under the title, so for this, we need to use the following. The below is an image of the code, don’t worry the actual code you can copy and paste is at the base of the post.

  4. Once you’ve entered the code, we need to change the settings

    We need to change the settings of the hook. To do this just select before_content from the drop down and check the execute PHP code box as below:Settings for element

  5. Lastly, still in the hook element we need to set the display rule

    I don’t personally want breadcrumbs shown on my homepage; we can stop that from happening. I’ve chosen to show on single posts/pages and not on the homepage, see below for this setting:Display rules for the element

  6. We’re done with the hook element next up we need to activate breadcrumbs.

    Ok so we’ve done the hard part (which wasn’t hard at all!) no we need to activate the breadcrumbs in the Yoast SEO plugin, really easy to do. So head on over to: Yoast SEO in the sidebar > Search Appearance > Breadcrumbs. Simply save your settings, refresh a page on your blog and you are good to go!Breadcrumb settings for Yoast SEO

  7. That’s it that’s all there is to it. You now should have breadcrumbs on your site!

    Please see below for code snippet used in the hook element. Please feel free to cut and paste.

<?php if ( function_exists('yoast_breadcrumb') ) { ?>
	<div class="grid-container grid-parent">
		<div class="page-header">
			<?php yoast_breadcrumb('<p id="breadcrumbs">','</p>'); ?>
	
		</div>
	</div>
<?php } ?>

That’s how you add breadcrumbs to the generatePress theme

No additional plugins are needed and no complex coding etc. Nice and simple, massive thanks to the people at GeneratePress for helping others by offering this code.

It’s for my reference hopefully useful to you as well

As I mentioned earlier, I’ve added this to LyrWP to remind me how to do it when working with the GeneratePress theme in the future. I can refer back to it in case I forget how to do it. Hopefully, it will help you as well.

If you’d like more tips and tutorials, please stay tuned to my tips & tuts section here.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.