2010-09-24 103 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 
相關問題