Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_filter('wp_nav_menu_items','add_search_box_to_menu', 10, 2);
- function add_search_box_to_menu( $items, $args ) {
- if( $args->theme_location == 'primary' )
- return $items.get_search_form();
- return $items;
- }
- // ή, εναλλακτικά
- add_filter('wp_nav_menu_items','add_search_box_to_menu', 10, 2);
- function add_search_box_to_menu( $items, $args ) {
- if( $args->theme_location == 'primary' )
- return $items."<li class='menu-header-search'><form action='http://example.com/' id='searchform' method='get'><input type='text' name='s' id='s' placeholder='Search'></form></li>";
- return $items;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement