我创建自定义帖子类型之前的旧代码:
<?php $featured_category = of_get_option('kategori_1'); ?>
<?php $category = get_cat_name($featured_category); ?>
<div class="featured-title">
<h4>
<a href="<?php echo get_category_link($featured_category);?>">
<?php echo $category; ?>
</a>
</h4>
</div>
<?php
global $post;
$category_id = of_get_option('kategori_1');
$my_query = new WP_Query('cat='. $category_id . '&' . 'offset=' . '&' . 'showposts='. '4');
while ($my_query->have_posts()) {
$my_query->the_post();
$do_not_duplicate = $post->ID;
/*my content */
} ?>
现在我创建了一个名为“product”的自定义帖子类型。我的问题是,如何按类别在get_option
中按类别显示我的帖子?