Categories
Genesis Tutorials SEO Opinion

Add Blog To Yoast Breadcrumbs On Single Posts In Genesis

This code enables you to add your blog page title to the breadcrumbs in any Genesis child theme when using yoast breadcrumbs. Yoast SEO also enables you to use any type of separator between breadcrumbs and modify your breadcrumbs to display the way you like them.

Yoast SEO Blog Breadcrumbs Genesis

If you’ve already added this code to your child themes functions file, you might notice your blog page title is still not showing in the breadcrumbs if you have the Yoast SEO plugin activated.

Add the PHP code from the download folder to the end of your child themes functions file ( without the opening PHP tag ) and swap out the page id for your blog page in the code.

Download Folder

Related Code Snippets

Categories
Genesis Tutorials

Add Blog To Breadcrumbs On Single Posts In Genesis

This code adds the blog name to your single post breadcrumbs when using the Genesis Blog Page Template.

We go from this :

To this :

Note : You will need to swap out 2 instances of the I.D for your blog page in the code. In this example, the blog page id is 248.

Add the code to the end of your child themes functions.php file.

Download Folder

This code also enables you to modify the default output for the breadcrumbs shown on single posts in any Genesis child theme.

Related Code Snippets

Categories
Genesis Tutorials

Remove Category From Breadcrumbs In Single Posts Using Genesis

This PHP code, once added to the end of your child themes functions file, will remove the category crumb from all single posts in any Genesis child theme.

We go from this :

To this :

Download Folder

Related Code Snippets

Categories
Free Tutorials Genesis Tutorials

Reposition Breadcrumbs On Single Posts In Genesis

This template enables you to remove the default position of the breadcrumbs and add them back in any Genesis hook position.

In this case, we use the genesis_after_entry_content hook however you can use any genesis hook.

#Installation

Create a new file named single.php in your child themes root directory and add the following PHP code to the file.

#Conditionally Reposition Breadcrumbs

You could also use PHP code in your child themes functions.php file to conditionally remove and add back your breadcrumbs in any hook position like this :

add_action( 'genesis_before_loop', 'reposition_breadcrumbs_conditionally', 5 );
function reposition_breadcrumbs_conditionally() {
if ( is_singular( 'post' ) ) {
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
add_action( 'genesis_after_entry_content', 'genesis_do_breadcrumbs' );
    }
}

Change the genesis_after_entry_content hook to any other genesis hook.

#Reposition Breadcrumbs After Header

add_action( 'genesis_meta', 'reposition_breadcrumbs_conditionally', 5 );
function reposition_breadcrumbs_conditionally() {

if ( is_singular( 'post' ) ) {

remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
add_action( 'genesis_after_header', 'genesis_do_breadcrumbs' );

}
}

If you’re using the Genesis Sample child theme, you’ll also need to add CSS to display the breadcrumbs below the fixed header.

.breadcrumb {
    margin-top: 40px;
}

Related Code Snippets

Categories
Free Tutorials Genesis Tutorials

Remove Genesis Breadcrumbs Conditionally

This code enables you to use conditional tags to remove the Genesis Breadcrumbs from any page or post. Once set in Genesis > Theme Settings > Breadcrumbs:

breadcrumbs

Here’s the code you can add to your child themes functions file:

add_action( 'genesis_before_loop', 'remove_breadcrumbs_conditionally', 5 );
function remove_breadcrumbs_conditionally() {
if ( is_post_type_archive( 'portfolio' ) ) {
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
    }
}

The above code removes the breadcrumbs from the portfolio post type archive page only.

Categories
Free Tutorials Genesis Tutorials

Shortcode For Breadcrumbs

This PHP code creates a very basic shortcode for displaying breadcrumbs in Genesis.

The reason i coded this is because a member wanted to float the breadcrumbs over a background image for a widgets like you see in the following image:

breadcrumbs-shortcode

Here’s the code:

This 1st snippet should be added to your child themes functions file and creates a shortcode named [breadcrumbs] you can use in a text widget or your wp editor.

add_shortcode( 'breadcrumbs', 'breadcrumbs_shortcode' );

function breadcrumbs_shortcode() {

	return genesis_breadcrumb();

}

This 2nd snippet adds support for using shortcodes in text widgets:

add_filter( 'widget_text', 'do_shortcode' );

And the 3rd snippet enables you to remove the shortcodes output using the Genesis > Theme Settings.

remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );

Style Breadcrumbs

Modify your themes existing CSS for breadcrumbs.

.breadcrumb {
    background-color: transparent!important;
}

Related Tutorials

Categories
SEO Opinion

How To Add Breadcrumbs Using Yoasts SEO Plugin in Any Theme

Yoast’s WordPress SEO plugin includes breadcrumbs which require manual installation of a template tag.

After installing the plugin, go to Internal Links and enable Breadcrumbs:

breadcrumb settings

Once you’ve enabled breadcrumbs, you can install a few lines of PHP code.

There’s 2 ways to install the breadcrumbs template tag:

You can:

  1. Add the template tag directly to your themes template file like your single.php file
  2. Or you can hook in the tag using a custom function.

Yoast’s Breadcrumbs Template Tag

The 1st method requires you paste the template tag in the position in your themes template file where you want the breadcrumbs to display.

Yoast’s Breadcrumbs Custom Function

The 2nd method requires you to paste this code into your child themes functions file and modify the conditional tag and/or hook position to suit your own requirements.

The loop_start hook will work in any theme however you can replace it with any theme specific hook or WooCommerce hook.

Yoast’s Breadcrumbs On CPT’s

If you want to display Yoasts breadcrumbs on single CPT’s or custom taxonomy types, simply replace the cpt-name in the following code with the name of your custom post type:

Or, you can use the previous code and the WordPress SEO plugin settings for posts types and taxonomy types without adding any conditional tags to the code:

cpt taxonomy

This tutorial is based on this forum question:

I’m using the yoast SEO plugin, and my breadcrumbs aren’t displaying anywhere on my woocommerce website or my blog pages.

I have the following settings turned on for the plugin;

Enable Breadcrumbs checked
Posts Taxonomy: Category
Products Taxonomy: Product Category

Post Type Archive: Product Category: Products

But the breadcrumbs aren’t appearing. Does anyone have any suggestions to help me get the breadcrumbs to display?

Related Tutorials

Categories
Free Tutorials Genesis Tutorials

Change Breadcrumbs In Genesis

You can easily enable or disable breadcrumbs from displaying on posts, pages, archives and your home page using the Genesis > Theme Settings > Breadcrumbs:

breadcrumbs

You can also customize what’s displayed in your breadcrumbs using filters.

Note: A filter simply enables you to modify an existing functions output to something different than the default. Rather than edit the parent theme frameworks files, you can use the genesis filters in your child themes functions.php file.

If you take a look in the breadcrumbs.php file which is included in the Genesis files, you’ll see a list of what can be customized.

Default Arguments

Here are the default parameters and values for the breadcrumbs in Genesis.

Any of these default arguments can be modified using a filter.

To remove or customize the ‘You Are Here’ text simply remove the text from the argument or replace it with your own custom text.

All custom functions should be copied from the view raw link in the Gist and pasted at the end of your child themes functions.php file using a code editor.

Remove ‘You Are Here’ Text

Change ‘You Are Here’ Text

Modify Home Text

This code changes the Home text to Front Page.

Modify Separator

You can then put all your modifications together into the one custom function and filter multiple arguments for better efficiency.

Reposition Breadcrumbs Using Genesis Hooks

You can easily change the position your breadcrumbs display in your theme using any genesis hook location.

Remove Breadcrumbs On Specific Page

You can easily change the conditional tag in this code snippet to suit your own needs and add the page/post i.d or slug for the one you want removed without effecting other areas of your site.

Other Modifications

This code adds classes which you can modify or use ‘as is’ to style your breadcrumbs.

Style Breadcrumbs

This CSS code will add a home icon in replace of the home text and additional styling which you can easily modify, add to or delete.

This CSS code has been modified from one of the Studio Press child themes.

style breadcrumbs

Genesis Simple Breadcrumbs Plugin

Another way to customize your breadcrumbs is to install the Genesis Simple Breadcrumbs plugin. This plugin enables you to modify all the default settings and label arguments without touching any PHP code.

Simple Breadcrumbs Plugin

This plugin has been developed by Copyblogger Media’s Nick Croft.

I’ll be writing more about how to use filters to modify the output of all the default Genesis functions over the coming months.

Related Tutorials