花開未央

獲取最新文章並附特色圖片的代碼

幫朋友寫的,順便放在這裡mark一下好了。

以下代碼實現獲取最新10篇日誌及其100×100像素的特色圖片。

[code type=php]
<?php query_posts(‘posts_per_page=10’); if (have_posts()) : while (have_posts()) : the_post(); ?>

<?php if (has_post_thumbnail()){the_post_thumbnail(array(100,100)); } ?>

<?php the_title(); ?>

<?php echo get_the_date(); ?>

<?php endwhile; endif;?>[/code]

退出移动版