Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #748845

    Hi team,
    i tried several ways to activate a mobile search form for my customer.

    Like this: https://kriesi.at/support/topic/search-button-on-mobile/
    or this: https://kriesi.at/support/topic/mobile-search-bar/ (i didn´t found >>do_action(‘ava_after_main_menu’);<<)

    But it doesn´t works…one time i had to recover the page.

    Hope u can help.

    WordPress: 4.7.2
    Enfold: 3.8.4

    Best regards,

    Alexander

    • This topic was modified 7 years, 10 months ago by alexandernoe.
    #748879

    Hey Alexander,
    If you want a search bar inside the mobile menu, add this in the functions.php file:

    add_filter( 'wp_nav_menu_items', 'avf_add_search', 3, 2 );
    function avf_add_search( $items, $args ) {
    	if ($args->theme_location == 'avia')
    	{
    		$search = '<li id="menu-item-search-mobile" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-18 current_page_item menu-item-top-level menu-item-top-level-5">'.get_search_form(false).'</li>';
    		$items = $search . $items;
    	}
    	return $items;
    }

    After that, use this code in the Quick CSS field:

    @media only screen and (max-width: 767px) {
    	#top #searchform>div {
    		display: block !important;
    		opacity: 1 !important;	
    	}
    }

    Best regards,
    Mike

    #754374

    Hi Mike,
    sorry for the delay…i was sick and out of order. :-(
    After entry the code as advised into Quick CSS the homepage was not longer reachable.
    I must recover the homepage from the backup.
    In the functions.php i found this code. Possible that the customer tried to do himselves. Hmm… ;-)
    Hope you can help.
    Additional i send you credentials for the WP dashboard
    Many thanks!
    Alexander

    /* AJAX SEARCH */
    if(!function_exists(‘avia_append_burger_menu’))
    {
    //first append search item to main menu
    add_filter( ‘wp_nav_menu_items’, ‘avia_append_burger_menu’, 9998, 2 );
    add_filter( ‘avf_fallback_menu_items’, ‘avia_append_burger_menu’, 9998, 2 );

    function avia_append_burger_menu ( $items, $args )
    {
    if(!avia_is_burger_menu()) return $items;

    if ((is_object($args) && $args->theme_location == ‘avia’) || (is_string($args) && $args = “fallback_menu”))
    {

    $items .= ‘<li id=”menu-item-burger” class=”av-burger-menu-main menu-item-avia-special”>

    <span class=”av-hamburger av-hamburger–spin av-js-hamburger”>
    <span class=”av-hamburger-box”>
    <span class=”av-hamburger-inner”></span>
    ‘.__(‘Menu’,’avia_framework’).’
    </span>
    </span>

    ‘;
    }
    return $items;
    }
    }

    #757719

    Hi!

    Thank you for the info.

    We implemented the code in the site. Please remove browser cache or hard refresh before checking the page.

    Best regards,
    Ismael

    #757740

    Hi Kriesi-Team, hi Ismael,

    YOU ARE THE VERY BEST!!! I can´t say it better…

    Many thanks

    Alexander

    #758174

    Hey!

    Glad that we could help. Please let us know if you need anything else. :)

    Cheers!
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Search Form on mobile devices’ is closed to new replies.