0

カスタム投稿タイプを作成する前の古いコード:

<?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私の質問は、古いコードのようにカテゴリ別に投稿を表示するにはどうすればよいですか?

4

0 に答える 0