我有我希望只是因爲我失去了一些東西明顯的一個奇怪的問題上......WordPress的「特色形象」停止工作自PHP頁面(V 3.8.1)
我們的WordPress安裝已經升級到3.8.1最近。我們在網站的一個目錄中使用WordPress作爲我們新聞的一部分。我們遍歷我們網站的其他部分內容了最新的消息等
我們精選啓用圖像,並有通過使用下面的代碼顯示的wordpress /新聞主頁上的特色照片:
<a href="<?php the_permalink() ?>"><div class="snippet-featured-img"><?php the_post_thumbnail('thumbnail'); ?></div></a>
這工作正常,並輸出150px的150px特色圖像。
我們也希望在我們在網站的其他頁面上循環播放的帖子旁顯示精選圖片,但我們似乎無法使其工作。
這是代碼:
foreach($posts as $post) {
setup_postdata($post);
if (has_post_thumbnail()) {
echo "<a href='";
echo the_permalink();
echo "'>";
the_post_thumbnail(array('50','50'));
echo "</a>";
}
echo "<h2><a href=\"";
echo the_permalink();
echo "\" rel=\"bookmark\" title=\"Permanent Link to ";
echo the_title();
echo "\">";
echo the_title();
echo "</a></h2>\n<p>";
$string = strip_tags(strip_shortcodes($post->post_content));
echo chop_string($string,190,'...');
echo " <a href=\"";
echo the_permalink();
echo "\" rel=\"bookmark\" title=\"Permanent Link to ";
echo the_title();
echo "\">";
echo "Read More</a></p>\n";
echo "<div class='clear'></div>\n";
}
員額VAR聲明高一點了腳本:
除了圖像$posts = get_posts('numberposts=8&orderby=date');
一切都被輸出,連圍繞在圖像應該鏈接be被輸出,表示has_post_thumbnail()func已經返回true。正如我所說,它也在wordpress頁面上工作。
我試着用'縮略圖'代替大小數組,而且還get_the_post_thumbnail(),我不知道爲什麼它不工作!
任何幫助將是巨大的
感謝