admin管理员组文章数量:1432055
I'm trying to display WooCommerce category on custom page which I can do it with WooCommerce short-code but I was unable get button like (showing all result),(default sorting).
How can I get these thing in custom page as we get it by default in shop page, to make more clear I have attached screenshot of my requirement.
I'm trying to display WooCommerce category on custom page which I can do it with WooCommerce short-code but I was unable get button like (showing all result),(default sorting).
How can I get these thing in custom page as we get it by default in shop page, to make more clear I have attached screenshot of my requirement.
Share Improve this question edited Dec 9, 2017 at 16:37 Drupalizeme 1,6262 gold badges13 silver badges17 bronze badges asked Dec 8, 2017 at 22:04 synersyner 12 bronze badges1 Answer
Reset to default 0You have to create a custom template for that. The template have to clone the content of taxonomy-product_cat.php
, which thankfully is basically a single line.
Your template will be something like this:
<?php
/**
* Template Name: YOUR TEMPLATE NAME HERE
*/
// Set the parameters of your query
$args = array( 'post_type' => 'product', 'product_cat' => 'YOUR_CATEGORY_SLUG_HERE' );
// Override directly the query of the page, so that it is propagated to all the functions and doesn't break any WooCommerce feature
query_posts( $args );
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
wc_get_template( 'archive-product.php' );
However I invite you to think about what you want to achieve exactly and if this is the way to achieve it. If you create a category page like this, the result will be a duplicated content without a canonical link, which is very bad for Google.
本文标签: categoriesWooCommerce category display in custom page
版权声明:本文标题:categories - WooCommerce category display in custom page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744593134a2614615.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论