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 and recognized MarTech expert. Doug is a Keynote and Marketing Public Speaker. He's the 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. He's assisted SaaS companies like Angie's List, GoDaddy, Salesforce, Webtrends, and SmartFOCUS with their digital marketing and product strategies. Douglas is also the author of Corporate Blogging for Dummies.

Check Also

Vision6 Marketing Automation

Vision6: An Affordable, Customizable, Enterprise Marketing Automation Solution

Australia’s largest email marketing company is now expanding into the United States, offering a customizable, …

Leave a Reply