Tagged: x
-
AuthorPosts
-
October 15, 2016 at 2:05 pm #1217514
AnnParticipantHi Guys,
Is there a way to add Woocommerce Search functionality to the main navigation bar?
Best,
AnnOctober 15, 2016 at 11:11 pm #1217790
Rue NelModeratorHello Ann,
Thanks for writing in! Regretfully, at this time I am not entirely certain what it is you would like to accomplish based on the information given in your post. If you wouldn’t mind providing us with a little more clarification on what it is you’re wanting to do (a link to a similar example site would be very helpful, or perhaps some screenshots), we’ll be happy to provide you with a response once we have a better understanding of the situation.
Please let us know how it goes.
October 15, 2016 at 11:19 pm #1217793
AnnParticipantHi Rue,
Thanks for your reply and I’m sorry for not being clear.
I installed woocommerce product search function, which is a separate, paid plugin, and I was wondering if I could add the search function to the menu bar instead of the built in search?
The plugin can be added as a widget or with a shortcode. I assume I’d have to make some template changes to add it to the menu bar though?
Does that makes sense at all?
Ann
October 16, 2016 at 3:37 am #1217906
Rue NelModeratorHello Ann,
Thank you for the clarifications! Since your child theme is set up, please add the following code in your child themeβs functions.php file
// Custom product search widget // ============================================================================= function custom_search_navbar_menu_item( $items, $args ) { if ( X_WOOCOMMERCE_IS_ACTIVE ) { if ( $args->theme_location == 'primary' ) { $items .= '<li class="menu-item current-menu-parent x-menu-item x-menu-item-woocommerce-search">' . do_shortcode('[woocommerce_product_search]') . '</li>'; } } return $items; } add_filter( 'wp_nav_menu_items', 'custom_search_navbar_menu_item', 9999, 2 ); // =============================================================================Please let us know if this works out for you.
October 16, 2016 at 11:15 am #1218275
AnnParticipantYes, that worked!
This might not be something you would help with but do you know how to add some padding above the search box?
I would also like to increase the width for the search result, any idea how? I can only change the thumbnail from the plugin setting. I believe I’d have to add custom CSS to do that.
Thanks!
Ann
October 16, 2016 at 11:16 am #1218277
AnnParticipantScreen shot file too big… here we go again π
October 16, 2016 at 11:18 am #1218278
AnnParticipantOk, last time!
LOL
October 16, 2016 at 12:09 pm #1218324
ThaiModeratorHi There,
Please provide us with your website URL so we can take a closer look.
Thanks.
October 16, 2016 at 12:14 pm #1218326
AnnParticipantOctober 16, 2016 at 12:50 pm #1218360
ThaiModeratorHi There,
Please add the following CSS under Customizer > Custom > Global CSS:
#product-search-form-1707334426 { margin: 9px 0 0; } .product-search.floating .product-search-results { min-width: 300px; }Hope it helps π
October 16, 2016 at 12:54 pm #1218363
AnnParticipantThanks for your quick response π
It worked for the width but the padding though
October 16, 2016 at 12:58 pm #1218367
ThaiModeratorHi There,
Please update the previous CSS a bit:
form.product-search-form { margin: 9px 0 0 !important; } .product-search.floating .product-search-results { min-width: 300px; }Hope it helps π
October 16, 2016 at 1:34 pm #1218394
AnnParticipantAwesome!
All good now, thanks a lot!
October 16, 2016 at 7:09 pm #1218619
RadModeratorYou’re so much welcome!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1217514 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
