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

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.