Take your website
To the next level
Discover our newly launched customization services and elevate your web projects to new heights.
Delegate tasks, save time, and unlock the power of professional WordPress outsourcing.

Okay
  Public Ticket #1165525
Search Bar
Closed

Comments

  • akmalpunya started the conversation

    Hi! I found this on the comment section:

    "how can i make the ”search area” or ”search icon” sitting on the same level of menu (nav). for example,

    item1, item2, itme3, search icon."

    I like to do the same on my site. I'm using the creative onepager. And I want to do settings on the search result page (set feature image, remove sidebar). Where can i find this?

    Thanks.

  •  7,122
    Oliver replied

    HI!

    Here is example for adding search form to the menu:

    function my_search_form( $form ) {
       $form = '
       <form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" >
          <label class="screen-reader-text" for="s">search:</label>
          <input type="text" value="' . get_search_query() . '" name="s" id="s" />
          <input type="submit" id="searchsubmit" value="Найти" />
       </form>';
       return $form;
    }
    add_filter( 'get_search_form', 'my_search_form' );
    function scalia_menu_item_search($items, $args){
       $var = get_search_form('my_search_form');
       if($args->theme_location == 'primary'){
          $items .= $var;
       }
       return $items;
    }
    add_filter('wp_nav_menu_items', 'scalia_menu_item_search', 20, 2);

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  • akmalpunya replied

    Hi, thank you. I will try it first.

  •  7,122
    Oliver replied

    Feel free to contact us if you need help.

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver