Created
April 14, 2016 19:10
-
-
Save ryantownley/5f74bf1805f2d50c88af480536c68e70 to your computer and use it in GitHub Desktop.
Add search to primary menu in Genesis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Add search to primary nav menu | |
add_filter( 'wp_nav_menu_items', 'add_search_primary_nav_menu', 10, 2 ); | |
function add_search_primary_nav_menu( $menu, stdClass $args ){ | |
if ( 'primary' != $args->theme_location ) | |
return $menu; | |
if( genesis_get_option( 'nav_extras' ) ) | |
return $menu; | |
$menu .= sprintf( '<li class="custom-search">%s</li>', __( genesis_search_form( $echo ) ) ); | |
return $menu; | |
} | |
//* Customize search form input box text | |
add_filter( 'genesis_search_text', 'edit_genesis_search_text' ); | |
function edit_genesis_search_text( $text ) { | |
return esc_attr( 'Search...' ); | |
} | |
//* Customize search form input button text | |
add_filter( 'genesis_search_button_text', 'edit_search_button_text' ); | |
function edit_search_button_text( $text ) { | |
return esc_attr( '' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment