admin管理员组文章数量:1335598
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.
本文标签: WooCommerce template page for category
版权声明:本文标题:WooCommerce template page for category 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742391496a2466079.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论