2010-10-17 148 views
0

我有一个WordPress自定义后置式设置。我创建WordPress自定义文章类型Single.php?

single-[customposttype].php 

然而,而不是只显示要求定制后型不言而喻的URL,然后显示在所有的定制式的职位。

这里是我目前使用的代码的副本:

<?php query_posts("post_type=shorts"); while (have_posts()) : the_post(); ?> 

<div class="header-promo"> 
    <?php echo get_post_meta($post->ID, "mo_short_embed", true); ?> 
</div> 
<div class="content-details"> 
    <h1><?php the_title(); ?></h1> 
    <?php the_content(); ?> 
</div> 

<?php endwhile; ?> 

感谢提前:)

+0

这样的问题是理想的http://wordpress.stackexchange.com/ – 2010-10-18 04:48:37

+0

谢谢安迪我也在那里发布了这个问题(http://bit.ly/c0q3WR) – 2010-10-18 09:35:29

回答

1

答案即将删除

query_posts("post_type=shorts"); 

这仅用于拉入自定义帖子类型的多个帖子,例如,创建一个档案样式的页面。

+2

啊,有道理,因为拉自定义slu post的帖子类型是多余的。很高兴你想出来了。 – awats 2010-10-19 23:53:59

0

尝试将 “posts_per_page”,并将其设置为1

query_posts(
'post_type' => 'shorts', 
'posts_per_page' => 1 
) 
+0

感谢您的答复,但这需要来自'shorts'post-type的第一篇文章,而不是所选的文章。 – 2010-10-18 09:34:31

相关问题