Home › Forums › WoodMart support forum › categories in the search bar
categories in the search bar
- This topic has 5 replies, 2 voices, and was last updated 6 years, 8 months ago by
Artem Temos.
-
AuthorPosts
-
June 20, 2018 at 7:19 pm #63932
[email protected]Participanthey
i would like to know how to get the categories in the search bar to be alphabetical
thanks
http://prntscr.com/jx99k7June 20, 2018 at 7:46 pm #63934
Artem TemosKeymasterHi,
You can sort your categories manually with drag & drop function in Dashboard -> Products -> Categories.
Regards
June 22, 2018 at 2:07 pm #64328
[email protected]Participantyou can see here http://prntscr.com/jy2fz2 that I did do exactly that. it is all sort out, however, the search bar categories didn’t change. I need them to be in a alphabetical order, please.
thanks.June 22, 2018 at 3:00 pm #64338
Artem TemosKeymasterTry to add the following PHP code snippet to the child theme functions.php file to do this
function woodmart_show_categories_dropdown() { $args = array( 'hide_empty' => 1, 'parent' => 0 ); $terms = get_terms('product_cat', $args); if( ! empty( $terms ) && ! is_wp_error( $terms ) ) { ?> <div class="search-by-category input-dropdown"> <div class="input-dropdown-inner woodmart-scroll-content"> <input type="hidden" name="product_cat" value="0"> <a href="#" data-val="0"><?php esc_html_e('Select category', 'woodmart'); ?></a> <div class="list-wrapper woodmart-scroll"> <ul class="woodmart-scroll-content"> <li style="display:none;"><a href="#" data-val="0"><?php esc_html_e('Select category', 'woodmart'); ?></a></li> <?php if( ! apply_filters( 'woodmart_show_only_parent_categories_dropdown', false ) ) { $args = array( 'orderby' => 'name', 'title_li' => false, 'taxonomy' => 'product_cat', 'walker' => new WOODMART_Custom_Walker_Category(), ); wp_list_categories($args); } else { foreach ( $terms as $term ) { ?> <li><a href="#" data-val="<?php echo esc_attr( $term->slug ); ?>"><?php echo esc_attr( $term->name ); ?></a></li> <?php } } ?> </ul> </div> </div> </div> <?php } }
June 22, 2018 at 3:27 pm #64342
[email protected]Participanti got back this messeage
Don’t Panic
The code snippet you are trying to save produced a fatal error on line 39:Cannot redeclare woodmart_show_categories_dropdown() (previously declared in /home/myshopsu/domains/shopping.duvys.media/public_html/wp-content/themes/woodmart/inc/template-tags.php:1490)
The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.Please use the back button in your browser to return to the previous page and try to fix the code error. If you prefer, you can close this page and discard the changes you just made. No changes will be made to this site.
June 22, 2018 at 6:34 pm #64380
Artem TemosKeymasterDid you try to add it to the child theme functions.php file? You don’t need to use our theme’s file. If it will not help, please, provide us your FTP access so we can check it.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register