-
AuthorPosts
-
March 9, 2018 at 4:24 am #924246
Dear Sirs,
In mobile menu there was a search field as you will see in attachment but after last Enfold’s update has been disappeared.
Pls see attachment: https://prnt.sc/ioqspn
The snippet code thas I was used for the search field on mobiles:
in Functions.php file:
/* Search Form on Mobile version */
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).’‘;
$items = $search . $items;
}
return $items;
}I am waiting for your precious help.
Thank You in advance.
Best Regards,
NickMarch 11, 2018 at 8:01 am #925174Hey nickgin,
Thank you for using Enfold.
Please remove the previous modification then add this code inside the functions.php file.
add_filter( 'wp_nav_menu_items', 'avf_add_search', 9999, 2 ); function avf_add_search( $items, $args ) { if ($args->theme_location == 'avia') { $search = 'li id="menu-item-search-mobile" class="menu-item"></li>'; $items = $search . $items; } return $items; } add_action('wp_footer', 'avf_add_search_script'); function avf_add_search_script(){ ?> <script type="text/javascript"> (function($) { $('.av-burger-menu-main').on('click', function() { var page = window.location.href; var mobile = $('.menu-item-search-mobile'); var search = '<form action="'+page+'" method="get" class=""><div><input type="submit" value="" id="searchsubmit" class="button avia-font-entypo-fontello"><input type="text" id="s" name="s" value="" placeholder="Search"></div></form>'; setTimeout(function() { if(mobile.find('form').length == 1) return; mobile.html(search); }, 500); }); })(jQuery); </script> <?php }
And add this css code in the Quick CSS field. Don’t forget to re-save the theme options, remove browser cache and do a hard refresh before checking the page.
#top #wrap_all #header #av-burger-menu-ul > li.av-active-burger-items.menu-item-search-mobile { padding: 0 30px; position: relative !important; } #top #wrap_all #header #av-burger-menu-ul > li.av-active-burger-items.menu-item-search-mobile form { position: relative !important; }
Best regards,
IsmaelMarch 12, 2018 at 4:07 am #925316Hi Ismael.
You are a so great developer!!! Your code works as always!!!
Thank you so much for your precious help!!
I really appreciate your excellent support!!!
You can close the ticket.
Best regards,
NickMarch 12, 2018 at 9:51 am #925401Hi Nick,
Glad that Ismael helped you, he’s an excellent and great support:) Thanks for using Enfold and have a great day!
Best regards,
Nikko -
AuthorPosts
- The topic ‘Search field on mobiles has been disappeared after last Enfold's update’ is closed to new replies.