メモ wordpressでサムネイル画像を読み込んで表示する(手動ギャラリー)
wordpressで投稿に関連付られたイメージを読み込み表示する方法。
gallery機能で同じ事ができますが、テンプレート中につかったり、装飾を変更するようにメモ
1 2 3 4 5 6 7 8 9 10 11 | <ul> <?php $files = get_children( "post_parent=$id&post_type=attachment&post_mime_type=image" ); $keys = array_keys ( $files ); foreach ( $keys as $key ){ $thumb =wp_get_attachment_thumb_url( $key ); $fullimage = wp_get_attachment_url( $key ); echo '<li><a href="' . $fullimage . '"><img src="' . $thumb . '" width="130" height="100"></a></li> ' ; } ?> </ul> |