我是一个用于展示woocommerce产品的自定义查询。现在我想在我的查询上面显示排序系统。喜欢商店页面。
我尝试了很多方法。但没有成功。我也跟着这个Article但结果一样,
这是我的查询代码
<div class="mproduct-area fix">
<?php
$mproduct = new WP_Query(array(
'post_type' => 'product',
'posts_per_page'=> 10,
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'combinations' ),
'operator' => 'NOT IN'
)
)
));
if($mproduct->have_posts()) : while($mproduct->have_posts()) : $mproduct->the_post(); ?>
<!--Single Product for Mobile Page-->
<div class="msingle-product fix">
<div class="msingle-product-image">
<a href="<?php the_permalink(); ?>">
<?php if(has_post_thumbnail( get_the_ID())){
echo get_the_post_thumbnail( get_the_ID(), 'com_product_img' );
} else {
echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" />';
}
?></a>
</div>
<div class="mproduct-price">
<h2><strong>Price : </strong> <?php echo $product->get_price_html(); ?></h2>
</div>
<div class="mproduct-name">
<h2><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( $product->get_title() ) ?>"><?php echo esc_attr( $product->get_title() ) ?></a></h2>
</div>
<div class="mproduct-add-to-cart">
<?php woocommerce_template_loop_add_to_cart(); ?>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"><?php echo esc_attr( $product->get_title() ) ?></h4>
</div>
<div class="modal-body">
<div class="msingle-product-image product_img_model">
<a href="<?php the_permalink(); ?>">
<?php if(has_post_thumbnail( get_the_ID())){
echo get_the_post_thumbnail( get_the_ID(), 'com_product_img' );
} else {
echo '<img src="' . woocommerce_placeholder_img_src() . '" alt="Placeholder" />';
}
?></a>
</div>
<div class="mproduct-price">
<h2><strong>Price : </strong> <?php echo $product->get_price_html(); ?></h2>
</div>
<div class="product_variable_list">
<?php wc_get_template_part('content', 'single-product'); ?>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Continue Shipping</button>
</div>
</div>
</div>
</div>
</div>
</div><!--/ Single Product for Mobile Page-->
<?php endwhile; endif;?>
</div>
显示排序系统需要哪些代码。请在我的查询中添加该代码
我希望Woocommerce默认所有排序列表如 默认排序, 按人气排序, 按平均评分排序, 按新意排序, 按价格排序:从低到高, 按价格排序:从高到低,
预先感谢您的帮助。