How do I change the WordPress template used for the WooCommerce category pages?
I can change the product pages by using the single-product.php template, but the category pages just use page.php which I don't want to modify because it is so sidely used.
How do I modify this template and only affect category pages? I am NOT interested in overriding the WooCommerce templates, I want to edit the surrounding template that contains the header, footer, etc.
How do I change the WordPress template used for the WooCommerce category pages?
I can change the product pages by using the single-product.php template, but the category pages just use page.php which I don't want to modify because it is so sidely used.
How do I modify this template and only affect category pages? I am NOT interested in overriding the WooCommerce templates, I want to edit the surrounding template that contains the header, footer, etc.
Share Improve this question edited Nov 8, 2018 at 11:30 Krzysiek Dróżdż 25.5k9 gold badges53 silver badges74 bronze badges asked Nov 8, 2018 at 11:22 William OakleyWilliam Oakley 1111 silver badge6 bronze badges2 Answers
Reset to default 2I had same problem and the solution is this
function mytheme_add_woocommerce_support() {
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );
WooCommerce categories are called product_cat
. If you check the WP template hierarchy, you see that for (custom) taxonomy archives, taxonomy-$taxonomy.php
works.
So in your case, creating a taxonomy-product_cat.php
should work.
You can copy the content from taxonomy.php, archive.php or index.php and start your work from there.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742391496a4435103.html
评论列表(0条)