我使用下面的代码来获取最受欢迎的缩略图帖子。我有一个自定义的post类型分类法(Talks)。自定义帖子类型(视频)有6个类别。
但我的代码不起作用。它刚刚得到一个帖子。但我有10个帖子。我怎样才能修复它?
<?php
$args = array(
\'post_type\' => \'video\',
\'showposts\' => 10,
\'order\' => \'DESC\',
\'meta_key\' => \'post_views_count\',
\'orderby\' => \'meta_value_num\',
\'tax_query\' => array(
array(
\'taxonomy\' => \'Talks\',
\'field\' => \'id\',
\'terms\' => array(
371,
372,
373,
374,
375,
376
)
)
)
); //
$loop = new WP_Query($args);
while ($loop->have_posts()):
$loop->the_post();
?>
<div class="box">
<a class="box-over" href="<?php
the_permalink();
?>">
<?php
if (($video_thumbnail = get_video_thumbnail()) != null) {
echo "<img src=\'" . $video_thumbnail . "\' class=\'videowisetalksthumb\' width=\'150\' height=\'108\' />";
}
?>
</a>
<p class="videotitle"><a href="<?php
the_permalink();
?>"><?php
the_title();
?></a></p>
</div>
<?php
endwhile;
?>