Home / WordPress / Add a Home Icon to the WordPress Navigation Menu

Add a Home Icon to the WordPress Navigation Menu

We love WordPress and work with it virtually every day. The navigation menu that’s been active in WordPress is incredible – a nice drag and drop feature that’s easy to use. If your theme doesn’t have a menu section where you can modify your menus, you need to find a new developer!

With the addition of our Ajax load, I wanted to reduce the size of the home link on the navigation menu and simply put a home icon. Adding an icon isn’t an option via WordPress, though, so we had to add the functionality through our theme’s functions.php file. I found a snippet online for adding the home link to the menu… I just had to modify it to use an actual image instead of the text link.

Add a Home Icon to WordPress

add_filter( 'wp_nav_menu_items', 'add_home_link', 10, 2 );
function add_home_link($items, $args) {
if (is_front_page())
$class = 'class="current_page_item home-icon"';
$class = 'class="home-icon"';

$homeMenuItem =
'<li ' . $class . '>' .
$args->before .
'<a href="' . home_url( '/' ) . '" title="Home">' .
$args->link_before . '<img src="[path to your home image]" height="15" width="14" />' . $args->link_after .
'</a>' .
$args->after .
$items = $homeMenuItem . $items;
return $items;

This code adds a class to the image as well so that you can adjust it’s location via your stylesheet.

Get Affordable WordPress Help Now

About Douglas Karr

Douglas Karr is the founder of The Marketing Technology Blog. Doug is the CMO of CircuPress and CEO of DK New Media, an agency specializing in assisting marketing technology companies with their inbound marketing - leveraging social media, blogging, search engine optimization, pay per click and public relations. Their clients include Angie's List, GoDaddy, Mindjet and many more. Douglas is also the author of Corporate Blogging for Dummies.

Check Also


We’ve Moved Hosts… You May Want To As Well

I’ll be honest that I’m incredibly disappointed right now. When managed WordPress hosting hit the …

Leave a Reply