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

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.