Forums Forums Search & Filter Pro Add searchform to menu

Viewing 5 posts - 1 through 5 (of 5 total)
  • Trevor
    #232322

    There are three ways:

    1. Add a shortcode.
    2. Change the HTML of the search already in the menu to send to a Search & Filter results/search page.
    3. Use a WordPress re-write to send to a Search & Filter results/search page.

    Which do you think would be best for you?

    Anonymous
    #232358

    I do think option 2 or 3!?? Even so with some assistance I think I can accomplish all of them…

    Trevor
    #232362

    OK, the easiest and least resource using is #2. How did you add the original search to the menu?

    Anonymous
    #232621

    This is the code in my child theme’s function.php that I added to add the search form:

    add_theme_support( ‘html5’, array( ‘search-form’ ) );
    add_filter(‘wp_nav_menu_items’, ‘add_search_form_to_menu’, 10, 2);
    function add_search_form_to_menu($items, $args) {
    // If this isn’t the main navbar menu, do nothing
    if( !($args->theme_location == ‘main’) ) // with Customizr Pro 1.2+ and Cusomizr 3.4+ you can chose to display the saerch box to the secondary menu, just replacing ‘main’ with ‘secondary’
    return $items;
    // On main menu: put styling around search and append it to the menu items
    return $items . ‘<li class=”my-nav-menu-search”>’ . get_search_form(false) . ‘‘;
    }

    Trevor
    #232695

    Ah. That we cannot use, I think.

    Are you able to send me a live link/URL to a page with the search in the menu so I can take a look?

Viewing 5 posts - 1 through 5 (of 5 total)