Genesis Tutorials

Tips, Tricks, and How-tos for the Genesis Theme Framework

  • The Genesis Developer’s HandbookVisual Hook Guide
  • code, settings & options oh my!Resources
    • Collection Of CodeSnippets
    • Under ConstructionGenesis Functions
    • Coming Soon…Utilizing Genesis SEO Options
  • Extend GenesisPlug-ins
    • Genesis Post Teasers
    • Genesis Favicon Uploader
  • Genesis Child ThemesThemes
  • What is genesistutorials.com?About
    • Genesis Tutorials Roadmap
You are here: Home / Theming / How to Filter the Genesis Breadcrumb Trail

Theming, Tutorial Filter

How to Filter the Genesis Breadcrumb Trail

June 21, 2010 by Christopher

Facebook0
Google+0
Twitter0

Breadcrumbs are a great way to add another form of navigation for users to easily find their way around sites as they dig deeper through articles and pages. In terms of usability, breadcrumbs can reduce the number of actions for users to return back to a higher level page that they were on a few moments before; and they are especially great to visually show someone’s location on sites if they just happened to land on a certain page through search, or a link.

Breadcrumbs can be enabled in the Genesis theme settings in the dashboard, where you will find four check boxes to have them either enabled or disabled on certain sections of sites. Once the breadcrumbs are activated, you should notice them above the content area. For example, if you are on your home page above the content area you should see: “You are here: Home” and if you want to change the text “You are here” or even the link to home, it is possible with a filter.

Below is an example on how to use the Genesis breadcrumb filter. The following snippet will change the default “you are here” text with an “x,” as well as use “>” for separators in place of the “/” and an image for the home link.

add_filter('genesis_breadcrumb_args', 'custom_breadcrumb_args');
function custom_breadcrumb_args($args) {
  	$args['labels']['prefix'] = 'x'; //marks the spot
  	$args['sep'] = '>';
  	$args['home'] = '<img src="'. get_bloginfo( 'stylesheet_directory' ) . '/images/homegraphic.png" alt="home">';
  	return $args;
}

To use the code above simply add it to your child theme’s function.php file and make any modifications you’d like.

List of all filterable items and their default values in the genesis breadcrumb trail are below.

 ['home'] = __('Home', 'genesis'),
 ['sep'] = '/',
 ['prefix']  = '<div class="breadcrumb">',
 ['suffix'] = '</div>',
 ['display'] = true
 ['labels']['prefix'] = __('You are here: ', 'genesis'),
 ['labels']['author'] = __('Archives for ','genesis'),
 ['labels']['tag'] = __('Archives for ','genesis'),
 ['labels']['date'] = __('Archives for ','genesis'),
 ['labels']['search'] = __('Search for ','genesis'),
 ['labels']['tax'] = __('Archives for ','genesis')

About Christopher

Dabbler of anything web/tech/design/music. Independent web designer & developer.

Follow me on twitter @tweetsfromchris

Comments

  1. scott says

    June 21, 2010 at 8:44 am

    Very helpful!

  2. Sam says

    January 21, 2011 at 5:23 am

    this is great – but you dont say which file or where to put any of this code – please explain, thanks

    • Christopher says

      January 21, 2011 at 12:58 pm

      Ah thanks for noting I didn’t say about where to put the code. I’ll be updating the post and any others to better explain.

      You will want to put this code in your child theme’s functions.php after this line of code:

      require_once(TEMPLATEPATH.'/lib/init.php');

      But before ?> at the end of the document (if exists)

  3. Angela Bowman says

    November 29, 2011 at 11:06 pm

    Hi Christopher,

    This is very helpful, but when I use the code you provide above, the breadcrumbs output the html source code instead of the image in the [home] argument. Have you tested this with a Genesis child theme? Will the home argument really output the image instead of the html for the image? It just doesn’t seem to be parsing the html for the img src.

    Thanks,

    Angela

    • Christopher says

      December 2, 2011 at 10:05 pm

      Angela,
      In a recent update of Genesis the output of the home strips any HTML :(. Going to see if I can find a way around this, but for now the best way may be to target it with css and use a background image and hide the text.

      • Angela Bowman says

        December 2, 2011 at 10:45 pm

        I got some code for the functions.php to append the a href for the home link, so what I did was added a class to the a href called “home.” Then, I gave that a class a background image and left the home link as a non-breaking space character. It’s working so far. I realized that the issue with the Genesis home variable in the breadcrumbs is that it does a bit too much with it. It uses it as both the text link but also as the “title” for the a href, hence why the html needs to be stripped out. So, yes, it would be better if Genesis simplified this a bit to allow for greater flexibility.

  4. Ankur says

    February 25, 2012 at 3:56 pm

    Thanks, its useful. I didnt knew about breadcrumb . I now use it my site.

Genesis Framework for WordPress

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Genesis Guide for Absolute Beginners

Click to download the Genesis Guide for Absolute Beginners

Follow me on Twitter

Follow @tweetsfromchris

Recent tutorials

Genesis 3.0.0 Removed Deprecated Functions

How to Add a Logo to the Header

Say Hello to the Genesis Visual Hook Guide v2.5

Genesis Tutorials • Built on the Genesis Theme Framework

Genesis Tutorials is not affiliated with StudioPress, and is maintained and operated by Christopher Cochran.

 

Loading Comments...