// Remove subcategories from the product loop
remove_filter( 'woocommerce_product_loop_start', 'woocommerce_maybe_show_product_subcategories' );
// Add subcategories before the product loop with priority 5
add_action( 'woocommerce_before_shop_loop', 'cg_show_product_subcategories', 5 );
function cg_show_product_subcategories() {
$subcategories = woocommerce_maybe_show_product_subcategories();
if ( $subcategories ) {
echo '<ul class="products subcategories">', $subcategories, '</ul>';
}
}
It separates subcategories from products, but lists subcategories in 1 column, and I don’t know where should I change it. Below is the picture where subcategories end, and products start:
Also longer pages (with using only default blocks) will start lagging very badly on the “Editor” even on a fast network..
And a very important feature is missing which is archive subcategories images and posts wont show.. even without WooCommerce.. hope to see it soon.
]]>Woocomerce verison 9.0.2.
Thank you in advance.
]]>I’m using version 6.7.0
Can you please help me to solve the problem?
roberto
Thanks in advance,
Tony
Woocommerce categories and products appear on the same row, in the same ul element. I personally find this confusing and was looking for a way to separate them.
I found this code, which looks like a very clean solution.
// Remove subcategories from the product loop
remove_filter( 'woocommerce_product_loop_start', 'woocommerce_maybe_show_product_subcategories' );
// Add subcategories before the product loop with priority 5
add_action( 'woocommerce_before_shop_loop', 'cg_show_product_subcategories', 5 );
function cg_show_product_subcategories() {
$subcategories = woocommerce_maybe_show_product_subcategories();
if ( $subcategories ) {
echo '<ul class="products subcategories">', $subcategories, '</ul>';
}
}
Source: https://www.commercegurus.com/docs/shoptimizer-theme/products-subcategories-separate/
The listings pages look much better like this!
The problem is that on my site (I’m using the Astra free theme), the categories are now showing twice. In their new place (before the shop loop, just above the ordering filter options, which is actually perfect and should be their default place in my opinion), AND in the shop loop alongside with the products (the default place where they already were before).
Could someone help me find the way to prevent them to show a second time in the shop loop?
And what’s about make this a default behaviour (or at least an option) in Woocommerce?
]]>Hello all.
I am having a great deal of trouble with 2024 WP with regards to navigation menus and categories. I was able to do this in the past but I can’t with the new block editor system. This is probably due more to my lack of understanding about the nuts and bolts of WP than the new system.
I am trying to achieve a nav bar that looks like this (items below top line are sub and subsub categories of ‘Posts’ that I would like to appear as a drop down menu):
Home?Posts?Etc Etc
Explore Posts by Country Explore Posts by Category
Egypt Outdoors
Turkey Food
etc etc
To create the ‘Posts’ link in the navigation menu I went to settings/reading/you home page display/posts page/posts. What I am unable to do is proceed beyond this point, and work out how to create the ‘Explore Posts by Country’ and Explore Posts by Category’ submenus. I have created them as categories, but they are ‘just names’ at this point. I don’t know how to link them to the navigation menu. I have created all the subsub categories (names of countries, names of categories) underneath the Parent Categories ‘Explore…Country’ and ‘Explore…Category’ and assigned my posts to them.
If anyone could please help I would be very grateful.
Thanks in anticipation, Jim
]]>I am having a great deal of trouble with 2024 WP with regards to navigation menus and categories. I was able to do this in the past but I can’t with the new block editor system. This is probably due more to my lack of understanding about the nuts and bolts of WP than the new system.
I am trying to achieve a nav bar that looks like this (items below top line are sub and subsub categories of ‘Posts’ that I would like to appear as a drop down menu):
Home Posts Etc Etc
Explore Posts by Country Explore Posts by Category
Egypt Outdoors
Turkey Food
etc etc
To create the ‘Posts’ link in the navigation menu I went to settings/reading/you home page display/posts page/posts. What I am unable to do is proceed beyond this point, and work out how to create the ‘Explore Posts by Country’ and Explore Posts by Category’ submenus. I have created them as categories, but they are ‘just names’ at this point. I don’t know how to link them to the navigation menu. I have created all the subsub categories (names of countries, names of categories) underneath the Parent Categories ‘Explore…Country’ and ‘Explore…Category’ and assigned my posts to them.
If anyone could please help I would be very grateful.
Thanks in anticipation, Jim
]]>