Skip to content

Instantly share code, notes, and snippets.

@billerickson
Forked from erkiziltoprak/functions.php
Last active December 1, 2022 15:06
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/6eca595fe86771d7f468f8c01da8b39e to your computer and use it in GitHub Desktop.
Save billerickson/6eca595fe86771d7f468f8c01da8b39e to your computer and use it in GitHub Desktop.
//* Add menu item to header-right menu
add_filter( 'wp_nav_menu_items', 'custom_nav_item', 10, 2 );
function custom_nav_item( $menu, $args ) {
//* make sure we are in the primary menu
if ( 'ana-menu' !== $args->menu ) {
return $menu;
}
//* see if a nav extra was already specified with Theme options
if ( genesis_get_option( 'nav_extras' ) ) {
return $menu;
}
//* append your custom code
$menu .= sprintf( '<li class="menu-item">%s</li>', __( '<a href="#" class="search-toggle"><span class="dashicons dashicons-search"></span></a>' ) );
return $menu;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment