2016-01-27 131 views
0

我正在一个电子商务网站上工作,我想知道是否有可能为帖子和woocommerce产品使用相同的类别?我想从特定类别中获得文章和产品。我试过这https://wordpress.org/support/topic/relating-a-post-to-a-product-category这使产品类别​​出现在帖子中,但我不知道如何在帖子循环中显示它们。woocommerce:加入发布和产品类别

<article <?php post_class(); ?>> 
    <header>  
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> 

    <?php the_tags('<ul class="entry-tags"><li>','</li><li>','</li></ul>'); 
    the_category(' '); ?> 
    </header> 

<div> 
    <?php the_excerpt(); ?> 
    <?php if (has_post_thumbnail()) { 
    the_post_thumbnail(); 
    } 
    ?> 
</div> 

</article> 

在此先感谢。

+0

由于产品是帖子,因此您可以让常规帖子和产品共享相同的类别。 –

+0

解释更多你想要完成的事情,以及到目前为止你能尝试做些什么来更好地帮助你。 –

+0

帖子和产品类似乎彼此分开 –

回答

0

结帐https://wordpress.org/support/topic/relating-a-post-to-a-product-category

主要思路是修改分类,以便用于产品和岗位类别,或更好地创造新的分类,以防止污染的原始分类。

+0

我以前检查过这个解决方案不起作用。 –

+2

让我们从你究竟做什么开始,为什么它没有工作?你有错误吗?或者它只是没有达到你想要的? –

+0

发布您修改的代码以检查出 –