0
我有一個WordPress的網站,我想創建一個博客頁面,它將顯示以下內容。如何獲取博客文章的精選圖片,內容,上次修改日期和評論數量?
- 在第一線的博客的特色形象
- 在第三行
- 最後更新,評論數第二行
- 博客內容(文本)的博客標題和發表在第四行。
我該怎麼做?
我直接查詢數據庫或使用一些內置函數?
任何幫助?
我有一個WordPress的網站,我想創建一個博客頁面,它將顯示以下內容。如何獲取博客文章的精選圖片,內容,上次修改日期和評論數量?
我該怎麼做?
我直接查詢數據庫或使用一些內置函數?
任何幫助?
query_posts();
while (have_posts()) : the_post();
if(has_post_thumbnail())
the_post_thumbnail('medium');
else {
$photos = get_children(array('post_parent' => get_the_ID(), 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'));
if ($photos) {
$photo = array_shift($photos);
echo wp_get_attachment_image($photo->ID, 'medium');
}
}
echo '<h2 class="entry-title"><a href="'.get_permalink().'" title="'.get_the_title().'">'.get_the_title().'</a></h2>';
the_excerpt();
endwhile;
wp_reset_query();
請將此問題移至wordpress.stackexchange.com – amolv