Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1185774

    Hello,
    I activated the search icon in my left menu but I don’t see it whereas I see it when the menu is displayed on the top.

    #1185803

    Edit : use the other method – it is much easier to understand Link

    you can insert on different ways a search icon to the navigation via child-theme functions.php

    f.e:

    add_filter( 'wp_nav_menu_items', 'avia_append_search_nav', 10, 2 );
    function avia_append_search_nav ( $items, $args )
    {
        if ((is_object($args) && $args->theme_location == 'avia') || (is_string($args) && $args = "fallback_menu"))
          {
              global $avia_config;
              ob_start();
              get_search_form();
              $form =  htmlspecialchars(ob_get_clean()) ;
    
              $items .= '<li id="menu-item-search" class="noMobile menu-item menu-item-search-dropdown menu-item-avia-special">
                     <a href="?s=" data-avia-search-tooltip="'.$form.'" '.av_icon_string('search').'>
                      <span class="avia_hidden_link_text">'.__('Search','avia_framework').'</span>
                     </a>
                   </li>';
          }
          return $items;
    }

    Rest is a little bit of styling via quick css f.e. that little white arrow etc.

    #1185825

    A maybe better and understandable way is to activate the search shortcode :

    this in child-theme functions.php

    add_shortcode('avia_search', 'get_search_form');
    

    after that you can input the search input field where you like via shortcode: [avia_search]

    Create an individual Link in your menu – best would be as the last entry – as url you can have #
    as label put in the shortcode:

    thats it –
    if you don’t like the ajax result preview put this in addition to your child-theme functions.php:

    add_action('avf_frontend_search_form_param', 'av_disable_ajax_search',9);
    function av_disable_ajax_search($params)
    {
    	$params['ajax_disable'] = true;
    	return $params;
    }

    looks this way:

    • This reply was modified 4 years, 9 months ago by Guenni007.
    #1185828

    read here somthing in additon: https://kriesi.at/documentation/enfold/search/

    for example to use instead relevansi search

    #1186076

    Hi,

    Thanks for helping out @guenni007, did you get your question answered @mguillou5670?

    Best regards,
    Rikard

    #1186085

    Thank you very much Richard and Guenni. Is it possible to have only the search icon as showned on the top menu ?

    #1186568

    that is the solution on part I: Link

    #1186843

    Thanks for your reply. I already used this solution, however I was not totally satisfied beacause it was not responsive.

    I tried to change in your code : add_shortcode(‘avia_search’, ‘get_search_form’ by replacing the function get_search_form by the proper one related to the icon. But I didn’t find it’s name. Do you have an idea on this ?

    Best regards.

    Muriel.

    #1187124

    Hi,
    Sorry for the late reply, I have taken a look at your page and see that you are using a sidebar menu, I see the search bar on both desktop and mobile. The add_shortcode('avia_search', 'get_search_form') is correct and there is not another one.
    but you can modify it by using the function $params['ajax_disable'] = true; above.
    can you please explain what you would like to see different with your search bar, perhaps a mockup would help us understand better.

    Best regards,
    Mike

    #1187217

    on the first link ( with only the zoom glass) :
    on hamburger case you can force both besides each other with some css like:

    @media only screen and (max-width: 989px) {
      .responsive.html_header_sidebar #header .av-main-nav > li {
        margin: 0;
      }
    }
    
    @media only screen and (max-width: 767px) {
      .responsive #top .av-main-nav .menu-item-avia-special {
        float: left;
      }
    }

    the styling of the active input field on non-hamburger case can be done too with css in quick css – but we had to know how it should look like for you.
    f.e. the width and that little arrow pointing to the magnifier etc:

    .avia-search-tooltip {
      width: 250px;
    }
    
    .avia-search-tooltip .avia-arrow-wrap {
      left: 10%;
    }
    #1187243

    Hello Guenni and Mike,

    Thank you very much for your help. and your time I guess I spend too much time for small details.

    Nevertheless, thank you very much Guenni, you definitely understood what I wanted to do and you gave my the right and successfull CSS code for the repsonsive part.

    Have a nice day both of you. :)

    #1187279

    Hi,

    Thanks for the update, I’m glad that Mike and Günter could help you out :-)

    Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1187306

    Thank you very much.
    I also added extra css so that the 2 icons can stand on the same line in desktop version and the result is quite good.
    You can close the topic. Once again thank you all of you for your kind assistance.

    @media only screen and (min-width: 767px) {
    .html_header_sidebar #header .av-main-nav > li:nth-of-type(8n), #top #menu-item-search.menu-item-search-dropdown {
    display:inline-block;
    padding-left:1rem;
    padding-right:1rem;

    }
    }

    #1187548

    Hi,

    Thanks for the update and for sharing your solution, it’s much appreciated :-)

    I’ll close this thread for now then, please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Search icon on left menu’ is closed to new replies.