【发布时间】:2014-09-09 02:03:45
【问题描述】:
我有一个名为照片库的自定义帖子类型。在那个帖子类型中,我注册了一个名为视频的分类法。然后我在视频下创建了两个类别,称为“个人”和“商业”。现在我只想将商业类别帖子显示到页面部分。我怎样才能做到这一点?这是我尝试过但不起作用的代码
<?php
$args = array(
'post_type'=>'photo_gallerys',
'post_status'=>'publish',
'video'=>'commercial',
'posts_per_page'=>-1,
'paged'=>get_query_var('paged')
);
// the query
$the_query = new WP_Query( $args ); ?>
<?php if ( $the_query->have_posts() ) : ?>
<!-- pagination here -->
<!-- the loop -->
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php the_title(); ?>
<?php endwhile; ?>
<!-- end of the loop -->
<!-- pagination here -->
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
【问题讨论】:
标签: wordpress categories taxonomy