search engine not showing all categories
-
The search engine doesn’t show all categories, don’t know where to add these. can anyone assist please
Attachments:
You must be
logged in to view attached files.
Hello,
Please provide the site admin access to the private area.
Best Regards
Hello,
Select categories hides the empty categories by default.
You can add this code snippet to the functions.php of the child theme to show emty categories in the header search:
function woodmart_show_categories_dropdown() {
$args = array(
'hide_empty' => 0,
'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(
'title_li' => false,
'taxonomy' => 'product_cat',
'use_desc_for_title' => false,
'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
}
}
Best Regards