正常に動作するスライダーがあります。私の主な質問は、私が使用しているループです。もっと単純化できますか?
注目の画像が添付された投稿を持つカテゴリをスライダーに入力しています。投稿のタイトル、著者、シンプルな [続きを読む] ボタンだけでなく、注目の画像も表示されます。
スライダー付きの私のループ
<div class="slider">
<ul class="slide">
<li>
<?php query_posts('showposts=1&cat=48'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php echo get_the_title(); ?>
<div class="latest-post">
<a href="<?php the_permalink() ?>" rel="bookmark">
<?php the_post_thumbnail(); echo '<p>read more</p>'; ?>
</a>
</div>
<p>Other posts by <?php the_author_posts_link(); ?></p>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
</li>
<li>
<?php query_posts('showposts=1&cat=49'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php echo get_the_title(); ?>
<div class="latest-post">
<a href="<?php the_permalink() ?>" rel="bookmark">
<?php the_post_thumbnail(); echo '<p>read more</p>'; ?>
</a>
</div>
<p>Other posts by <?php the_author_posts_link(); ?></p>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
</li>
<li>
<?php query_posts('showposts=1&cat=50'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php echo get_the_title(); ?>
<div class="latest-post">
<a href="<?php the_permalink() ?>" rel="bookmark">
<?php the_post_thumbnail(); echo '<p>read more</p>'; ?>
</a>
</div>
<p>Other posts by <?php the_author_posts_link(); ?></p>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
</li>
<li>
<?php query_posts('showposts=1&cat=51'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php echo get_the_title(); ?>
<div class="latest-post">
<a href="<?php the_permalink() ?>" rel="bookmark">
<?php the_post_thumbnail(); echo '<p>read more</p>'; ?>
</a>
</div>
<p>Other posts by <?php the_author_posts_link(); ?></p>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
</li>
</ul>
</div>