我试图排除两个特定类别(精品手表,精品首饰)的产品,使其不会出现在内容单一产品页面的相关产品中。我偶然发现的最接近的想法是woocommerce\template\single-product\中名为related.php的文件中的代码:
$args = apply_filters('woocommerce_related_products_args', array(
'post_type' => 'product',
'ignore_sticky_posts' => 1,
'no_found_rows' => 1,
'posts_per_page' => $posts_per_page,
'orderby' => $orderby,
'post__in' => $related,
'post__not_in' => array($product->id)
) );你知道如何修改这段代码吗?还是我看错了?
发布于 2014-01-02 14:30:21
你应该使用
'post__not_in' => array($product->id)https://stackoverflow.com/questions/18151514
复制相似问题