Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Exit if accessed directly
- if ( !defined('ABSPATH')) exit;
- /**
- *
- * Add search to main menu
- *
- */
- add_filter('wp_nav_menu_items','add_search_box', 10, 2);
- function add_search_box($items, $args) {
- if($args->theme_location == 'header-menu') {
- ob_start();
- get_search_form();
- $searchform = ob_get_contents();
- ob_end_clean();
- return $items .= '<li id="searchform-item">' . $searchform . '</li>';
- }
- return $items;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement