In this tutorial, we’ll show you how to replace the ‘Home’ text in breadcrumb of Genesis Framework to a nice home icon. Genesis has genesis_home_crumb
and genesis_breadcrumb_args
to allow users to customize the output of the breadcrumb.
To replace the default ‘Home’ text with the home icon, first you’ll need to register any icon font set such as Font Awesome, Genericons, Dashicon, or an icon font of your own choice.
Here, we’ll be using Dashicons. WordPress has already bundled the Dashicons icon font in the core so you’ll need to enqueue it using the following code.
1 2 3 4 5 6 7 |
|
The code above should go into your child theme’s functions.php
file. Next, we’ll use genesis_home_crumb
filter to replace the default texts with our home icon. Also, we use home_url()
here to automatically link the icon to the front page of our site. The code below also belongs to functions.php
file.
1 2 3 4 5 6 7 8 |
|
As you can see, dashicons dashicons-admin-home
is the class of our home icon. For Dashicons, you can get this from Dashicons’s official page. You need to use the right class here for the home icon and in case you want to use different icon or want to use other set of icon font, make sure to change class as well.
Now, please refresh your browser and you’ll see a nice home icon in the breadcrumb.
Next, if you want remove the ‘You are here’ texts, that can be done using genesis_breadcrumb_args
filter. Here’s a snippet you can:
1 2 3 4 5 6 7 8 |
|
And here’s after we’ve removed the default ‘You are here’ texts:
In case you want to change thr color of the icon to match the design of your theme, that can easily be done by targeting the right class. Here’s an example:
1 2 3 |
|
The code above should go into your theme style.css file and it will simply change the color of the icon to red. In case some of you might wondering whether this tutorial can be used on other WordPress themes, then the answer is simply no because the genesis_home_crumb
and genesis_breadcrumb_args
belongs to Genesis Framework and therefore can only be used on Genesis Framework child themes.
Ryan Biddulph says
Nice coding insight here. I’m not a Genesis guy and love my theme but will reference this in the future, should I go down that road.
Kingsley says
Nice tutorial but unfortunately it did not work for me
Editor says
Hi,
We just use the exact same code for our next project and it works perfectly. Just make sure you don’t copy the opening php tag. That might cause the error.
Mi Muba says
Very clean coding. My two blogs are on Genesis and was badly feeling to enhance the visibility of breadcrumbs on it. This will be of great help to me. I read a few more of your blog posts. They are very focused and its nice to see another great blog on WordPress techies. Thanks for sharing
Nisha says
Fantastic tutorial. I will try it out anytime.
Rick R. Duncan says
Great tutorial. I’ve made other Genesis customizations to their breadcrumb but never replaced the word home with an image/icon. I grabbed your code and edited it to work with font awesome and everything works perfectly.
Thanks for the tutorial.
-rd
Areesha Niir says
Hello Admin,
First time I visit this blog. and this is really great coding. Home icon is looking good instead if Text in Breadcrumb.
Thanks for sharing such clean cod.
Areesha Noor!
Bilal Ahmad says
I really appreciate your efforts. Very well explained. Just like the wpbeginner your blog is going to become another source for working and accurate coding related tutorials. Well done.