トップ特定カテゴリ新着記事の画像をサムネイルに
-
PHPのわからないwordpress初心者です。
◉wordpress3.4.1
◉PHP5.3.5
◉MAMP1.9.6ローカル環境で作成中自作テーマを作成中です。
トップページに特定カテゴリの新着記事5件(タイトル・本文抜粋/moreタグ・投稿画像1枚)を表示させたいのですが、
どうやっても画像をサムネイルにすることができません。
プラグイン(Auto Post Thumbnail)も入れましたが作成してくれません。下記のget_childrenタグでサムネイルは作成できたのですが
サムネイルと一緒に元画像(投稿画像)も表示されてしまいます。<?php $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 '<a href="' . clean_url(get_permalink()) . '" title="' . the_title_attribute('echo=0') . '"><img src="' . clean_url($thumb) . '" width="100" height="100" alt="' . the_title_attribute('echo=0') . '" />' . "\n"; } ?>http://ja.forums.wordpress.org/topic/6442?replies=13
のフォーラム記事も試したのですが
サムネイルにならず、同じ画像が2枚表示されてしまいます。こちらは特定カテゴリ抽出の今貼付けているコードです。
<?php query_posts('posts_per_page=5&order=desc&cat=5'); ?> <?php while (have_posts()) : the_post(); ?> <h6><a>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h6> <?php the_content(); ?> <?php endwhile;wp_reset_query(); ?>何卒宜しくお願いいたします。
1件の返信を表示中 - 1 - 1件目 (全1件中)
1件の返信を表示中 - 1 - 1件目 (全1件中)
トピック「トップ特定カテゴリ新着記事の画像をサムネイルに」には新たに返信することはできません。