2010-09-24 95 views
3

我已经尝试了插件中下面的方法:访问后自定义变量 - WordPress的

get_post_meta($featuredPosts[$i]->ID, "Thumbnail", true); 

下面的插件代码中:

$featuredPosts = new WP_Query(); 
$featuredPosts->query('showposts=5&cat=1'); 

for($i=1; $i<=$featuredPosts; $i++) { // second for() loop for post slides 
     while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); // loop for posts 

      get_post_meta($featuredPosts[$i]->ID, "Thumbnail", true); 

     endwhile; 
} 

不幸的是这不返回任何值:(


任何想法家伙?

回答

0

通过以下方式获取帖子ID修复:

$featuredPosts->posts[$i]->ID