【发布时间】:2018-05-29 16:40:45
【问题描述】:
我想从 woocommerce 的一个类别中获得 10 种产品
例如,为了获取帖子类别的最新帖子,我使用以下代码
<?php $posts = get_posts( 'category=17&numberposts=5' ); ?>
<?php if( $posts ) : ?>
<ul>
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<li><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><i class="circle"></i><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
我想要一个代码,像这样用于获取 woocommerce 产品
【问题讨论】:
标签: wordpress woocommerce