Reply To: Placing AJAX search pro into header/nav bar

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Placing AJAX search pro into header/nav bar Reply To: Placing AJAX search pro into header/nav bar

#5663
atomheartBLACK
atomheartBLACK
Participant

Hi there,

Thanks for the reply!

Here is the code I used in the functions.php:

add_filter('wp_nav_menu_items','x_add_search_to_navbar',10,2);
function x_add_search_to_navbar( $items_html, $args ) {
  //If menu class has x-nav, but this isnt the footer
  if ( isset($args->menu_class) && strpos($args->menu_class, 'x-nav') !== false &&
     ( ! ( isset($args->theme_location) && 'footer' == $args->theme_location ) ) ) {

    ob_start();
    get_search_form();
    $items_html .= '<li>' . ob_get_clean() . '</li>';
  }
  return $items_html;
}

I am not too sure where to place the .php shortcode for the AJAX search.

Can you please help

Thanks