Adding “Blog” to Genesis Breadcrumbs

One of the many great features of Genesis is the built-in breadcrumbs. No plugin is required, and they’re VERY customizable. Of course there’s the Breadcrumb toggles in Genesis > Theme Settings that let you specify where they show up. But you can do a lot more with code.

If you look in /genesis/lib/classes/breadcrumb.php you’ll see all the code used for the breadcrumbs. For each instance of a breadcrumb (single, archive, home, blog, page…) there’s a function for it and a filter to modify that function’s output.

To modify the breadcrumbs, just pick the filters you want to use and write a function that does something with the $crumb.

In this example, I’ll  add “Blog” before “Category” on the category and single breadcrumbs. By default, the breadcrumb renders this:

  • On blog home: Home > Blog
  • On category: Home > Category
  • On single post: Home > Category > Post Title

Here’s how I do it:

The bottom two lines are the filters I want to modify (single and archive). In my function I’m using get_option('page_for_posts') to get the ID of the blog homepage.  I’m then using the core WordPress functions get_permalink() and get_the_title() to return the permalink and title of this page ID.

This line ( if ( is_singular( 'post' ) || is_category() ) ) ensures this only applies to blog posts and post categories. The filters are also used for posts in custom post types and taxonomies.

basic breadcrumb genesis wordpress

Receive New Posts by Email


  1. Pingback: WordPress Community Links: Mobile townhall edition | WPCandy
    1. Can you post the exact code you’re using? It looks like you’re using get_permalink() and get_the_title() without adding get_option( 'page_for_posts' ) inside it.

        1. It sounds like the issue is that you’re using the homepage for your blog. This code only works (and is only needed) if you’re using a custom page for your blog, set in Settings > Reading. When your blog is your homepage, the Home link goes to your blog already.

  2. Bill, does this method still work after the latest update to Genesis and Prose? I followed the code but it seems to be no -go.

    1. Yes it does since the latest version didn’t change the Breadcrumbs. Genesis is built to be very backwards compatible, so updating it should never break existing functionality like this.

  3. Thanks Bill, this worked great. Just one thing though, how would I get the breadcrumb to not show the category name on posts? (As the url and breadcrumb don’t match)

    Currently shows:
    Home / Blog / {category} / {name of post}

    Want to show:
    Home / Blog / {name of post}

    Any help would be much appreciated!

    1. Try this instead:

      The code in the tutorial simply adds “Blog” to the beginning of the current breadcrumb. In the code I provided above, we’re also changing the breadcrumb on single posts to just be the post title (and then after that, the Blog part is added to the beginning)

      1. Hi Bill, sorry to trouble you but, in which file is this code added? I’m using an Imagely child theme which does not have a breadcrumb.php file and I’m loathe to edit the one in the Genesis directory.

        Thanks and best wishes

    1. Remove the add_filter( ‘genesis_single_crumb’ )… line, since that code applies it to the single posts.

      It’s also a good idea to remove the is_singular() conditional. Even though this code doesn’t run on single posts once you make the above change, for clarity all references to the single post should be removed.

  4. Any clue how to get blog in the URL? When I click blog it has but when it goes to a single page it’s just

    I had this working a ways back but lost the snippet : / and am thumping my head on the desk now! Thanks!

    1. Go to Settings > Permalinks, select “Custom” and then type /blog/ . That will add /blog/ to the front of all the single post permalinks.

      1. Yup figured that part out but all my custom post types and taxonomies had /blog/ placed in front of their URLs as well, after some research I added the below code when registering CPT’s and TAXs and it starts at the root URL removing blog, thanks for the reply as always and if you have a better approach I am all ears. Hope that’s not too much code to include:

        Front set to false being the key bit here.
        ‘rewrite’ => array( ‘slug’ => ‘promotions/’, ‘with_front’ => false),

  5. Can’t seem to get this working. I’m setup with a blog roll page and trying for a breadcrumb of: sitename / blog / post name. (ie. no category used). This works in the permalink but not breadcrumb – any ideas? Thanks Bill.

  6. I have a custom post type (Homes) that is searchable by several taxonomies and their terms (Style: Ranch, Cape Cod, etc), how can I get the searched terms to appear in the breadcrumbs (i.e. Browse Homes > Search for “Ranch, 3 Bedrooms, 2 Bathrooms”)?

    1. You’ll need to use the filter genesis_search_crumb to customize the search results breadcrumb with whatever content you’d like.

  7. Do this have any SEO impact?
    I thought the breadcrumbs (URL) trail is not well structured after adding the blog element. >> >>

    I did this, just because of the multisite forces blog slug and I had to do a hack to remove blog slug, but breadcrumbs still remains with blog page.

    Home >> Blog >> Category >> Post
    (Breadcrumb and URL trails are not the same)

    Now I’m not sure if this could have a negative impact in the way Google read my site structure and show breadcrumbs in search results snippets.

    1. I’m not an SEO expert so can’t comment on the SEO impact of breadcrumbs. If you’re worried about it I recommend you use the breadcrumbs built into Yoast SEO (they will replace the Genesis ones).

  8. I want to enable breadcrumb in genesis theme but don’t want to show that up in search results, is there any way to do this??

  9. Bill thanks for all of your nice tutorials and code snippets. I was trying to get this working with custom post types so that my breadcrumbs look like this CPT>Taxonomy>Post title. Any pointers would be greatly appreciated.

    1. It should work in the same manner. All singular pages (single posts, single page, single cpt…) use the genesis_single_crumb filter. So either use the function above on single-events.php (or whatever your post type is), or put it in functions.php and check the post type. Then add the taxonomies as you like.

      For instance, if you are using BE Events Calendar to add an ‘events’ post type and have enabled the event-category taxonomy, use this in functions.php or single-events.php to include the category in the breadcrumb:

      1. Bill, is there a filter for archive pages? I used the method you linked to in your response to Lou and got this up and running on my CPT’s single pages, but if I visit a term archive page, it pretty much just says, “HOME / Term” without reflecting the CPT Parent-link like it does on the single-post pages where it outputs “HOME / CPT / Term / Post”

        I was trying to modify your code, but then I realized per your explanation for Lou that this is aimed at singular pages.

        1. The genesis_archive_crumb filter should work for all archives (including CPT archives). You can use genesis_post_type_crumb filter to only target CPT archives.

          See /genesis/lib/classes/breadcrumb.php and search for “apply_filters” to find all available filters.

          1. Thanks, Bill. Using your suggestion, I just set up another function right below the one for the single pages, but this time I just changed the top conditional to:
            if( !is_tax(‘taxonomy-name’))
            and then I changed up the breadcrumb trail a little bit to add in the CPT archive and output the term name… and then hook the function to the genesis_archive_crumb filter and it seems to do the trick.

  10. Thanks so much! Your code worked great! I have a specific page that I wanted to add before a specific category list which looks like this:
    Home > specific page > category list > post

    so I tweaked the code for the following:

    Now the Breadcrumb looks like:

    Home > Overview Page > Category > post

    Hope I explained it clearly. But it works like a champ for me.

    Thanks so much for the inspiration!!

    1. Looks good to me. The only thing I’d do differently is use home_url( 'xxx-overview-page/' ) instead of hardcoding a relative URL. If the site is ever moved to a subdirectory (ex: a staging site or a local development environment) the relative URL won’t work but home_url() will.

      Another option would be to use the post ID of the page in question, like get_permalink( 1234 ) in case the URL slug ever changes in the future.

Leave a comment