哎哟,我的头撞到墙上了!
我正在尝试在索引中查询我的帖子类型“clips”。php,但它只返回默认“post”中的post。我需要一些洞察力!我做错了什么?
我的帖子类型:
$args = array(
\'labels\' => $labels,
\'supports\' => $supports,
\'hierarchical\' => false,
\'menu_position\' => 4,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'public\' => true,
\'query_var\' => true,
\'capability_type\' => \'clip\',
//\'map_meta_cap\' => true,
//\'capabilites\' => $capabilities,
);
register_post_type( \'clip\', $args );
我的查询(index.php):<?php query_posts(array(\'posts_per_page\' => 17, \'post_type\' => array(\'clip\'))); ?>
<?php if (have_posts()) : ?>
<ul id="clips" class="clearfix reset">
<?php while (have_posts()) : the_post(); ?>
<li>
<?php the_title();?><br><?php the_permalink(); ?>
<a id="post-<?php the_id(); ?>" class="videolink" title="Click to view" href="">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else {
echo "No thumbnail";
} ?></a>
</li>
<?php endwhile; ?>
</ul>
<?php else: ?>
<p>Sorry, but this content is not available.</p>
<?php endif; ?>
请注意,模板文件中没有其他循环。