同じサムネイル画像が重複して表示されてしまう
-
トップページに記事のサムネイル画像と、本文を抽出して表示させていまして、
本文は65文字以内、画像は上限4枚まで表示という様にしているのですが、
何故か記事中には1つしか画像を投稿していないのに、
サムネイルの同じ画像が数枚重複して表示されてしまうのです。下記サイトの中段お知らせ部分の一番上の記事です。
http://www.ebisuya.com/test110221下記が埋め込んでいるタグです。
<div id="news"> <h2>お知らせ</h2> <p class="list"><a href="info_test/">お知らせ一覧</a></p> <?php query_posts('cat=3&showposts=3'); ?> <?php while (have_posts()) : the_post(); ?> <h3><?php echo date("Y年m月d日", strtotime($post->post_date)); ?><br> <strong><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></strong></h3> <p><?php echo mb_substr(strip_tags($post-> post_content), 0, 65); ?>...<p> <p><a href="<?php the_permalink() ?>" class="thum-mini"> <?php $images = get_children( array( 'post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', ) ); $i=0; foreach ( (array) $images as $attachment_id => $attachment ) { $src = wp_get_attachment_image_src( $attachment_id, 'thumbnail' ); echo '<img width="150" src="' . $src[0] . '" />'; if (2<$i){ break; } $i++; } ?></a></p> <p class="details"><a href="<?php the_permalink(); ?>">詳細を見る</a></p> <?php endwhile;?> </div>
原因が分かりません。。
どなたか解決方法をご教授頂けると助かります><
12件の返信を表示中 - 1 - 12件目 (全12件中)
12件の返信を表示中 - 1 - 12件目 (全12件中)
- トピック「同じサムネイル画像が重複して表示されてしまう」には新たに返信することはできません。