Wordpressで、写真等をブログ記事内から摘出して一覧表示する為のphpコード。
この記事は、『beabo』さんの所で紹介されています。
<?php
query_posts('showposts=10');
if ( have_posts() ) : while ( have_posts() ) : the_post();
$files = get_children("post_parent=$id&post_type=attachment&post_mime_type=image");
if (!empty($files)){
$keys = array_keys($files);
$num=$keys[0];
$thumb=wp_get_attachment_thumb_url($num);
print '<div class="クラス名"><a href="' . clean_url(get_permalink()) . '" title="' .
the_title_attribute('echo=0') . '"><img src="' . clean_url($thumb) .
'" width="50" height="50" alt="' . the_title_attribute('echo=0') . '" /></a></div>' . "\n";;
}
endwhile;else:
endif;?>
赤字の部分で、クラスを指定して画像間のスペース等を調整
青字の部分を変更すると、サムネイルのサイズが変えれます。