Viewing 6 posts - 1 through 6 (of 6 total)
-
AuthorPosts
-
November 13, 2018 at 12:30 am #1032810
Hello,
Yes I have checked all those previous threads and those are very conflicted, someone said worked and someone said not worked.
So, I have created this post to get a final CSS code which will allow a search bar for mobile version.
Thanks
November 15, 2018 at 7:11 pm #1034093Hey Sovik,
I don’t see the search bar at all. Do you have it added somewhere?
Best regards,
VictoriaNovember 15, 2018 at 7:53 pm #1034110This reply has been marked as private.November 19, 2018 at 5:51 am #1035017Hi,
Thanks for the update.
Add this code on the functions.php file to render the search icon inside the mobile menu:
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 }
After that, add this css code on the Quick CSS field:
#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; }
Related thread: https://kriesi.at/support/topic/search-field-on-mobiles-has-been-disappeared-after-last-enfolds-update/#post-925174
Best regards,
IsmaelDecember 9, 2018 at 12:35 am #1042619This reply has been marked as private.December 10, 2018 at 1:59 pm #1043080Hi,
Add this filter to exclude other posts types from the ajax search.
add_filter('avf_ajax_search_query', 'avf_ajax_search_query_mod', 10, 1); function avf_ajax_search_query_mod( $search_parameters ) { $footer = avia_get_option( 'footer_page', 0 ); $defaults = array('numberposts' => 5, 'post_type' => array( 'product' ), 'post__not_in' => array($footer), 'post_status' => 'publish', 'post_password' => '', 'suppress_filters' => false); $_REQUEST['s'] = apply_filters( 'get_search_query', $_REQUEST['s']); $search_parameters = array_merge( $defaults, $_REQUEST ); return $search_parameters; }
Best regards,
Ismael -
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.