Skip to content

Instantly share code, notes, and snippets.

@dhigginbotham
Created March 30, 2013 02:53
Show Gist options
  • Save dhigginbotham/5275108 to your computer and use it in GitHub Desktop.
Save dhigginbotham/5275108 to your computer and use it in GitHub Desktop.
Nav filter for wordpress
add_filter('wp_nav_menu_items','search_box_function', 10, 2);
function search_box_function( $nav, $args ) {
if( $args->theme_location == 'main-nav' ) {
//echo count($nav);
//print_r($nav);
//$navbit = explode("\n", $nav);
//print_r($navbit);
if (!is_front_page()){
$navHTML = "<li id='menu-header-home'><a href='". home_url() ."' title='Return to Home Page' alt='Return to Home Page' class='icon-home nav-icon'>&nbsp;</a></li>\r\n";
}
$navHTML .= $nav . "\r\n";
if (is_front_page()) {
$navHTML .= "<li id='menu-header-livechat'><a href='". home_url() ."' title='Click for LiveChat' alt='Return to Home Page' class='nav-icon icon-users'>&nbsp;Live Chat</a></li>\r\n";
}
return $navHTML;
}
return $nav;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment