This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Add search to functions.php?

#22470
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Well, based on the code and the instructions, then make sure to remove that previous code, and try this one instead:

function asp_thegem_menu_item_search($items, $args){
    if($args->theme_location == 'primary' && thegem_get_option('header_layout') !== 'overlay' && !thegem_get_option('hide_search_icon')) {
        $items .= '<li class="menu-item menu-item-search">
          <div>'.do_shortcode('[wpdreams_ajaxsearchpro id=1]').'</div>
        </li>';
    }
    return $items;
}
add_filter('wp_nav_menu_items', 'asp_thegem_menu_item_search', 10, 2);

I don’t know if this is going to work correctly as it should, as I cannot test this, but there is a chance that it might do the trick.