自作テーマを作成中です。
投稿を5件表示させて、6件目より古い投稿はページネーションによってブラウズ出来るようにさせたいのですが、どうすればよいでしょうか。
現在のコードは以下です。
php
1<?php if ( is_home() || is_front_page() ) : ?> 2<?php if (have_posts()) : query_posts('posts_per_page=5'); ?> 3<?php while ( have_posts() ) : the_post(); ?> 4<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> 5<span class="post-date"><?php the_time('Y年n月j日'); ?></span> 6<?php the_except(); ?> 7<?php endwhile; ?> 8<?php endif; ?> 9<?php else : ?> 10<?php if ( the_post() ) ; ?> 11<div class="post"> 12<h1 class="post-title"><?php the_title(); ?></h1> 13<span class="post-date"><?php the_time('Y年n月j日'); ?></span> 14<p class="postmetadata"><?php the_category(', '); ?></p> 15<div class="entry"><?php the_content(); ?></div> 16</div> 17<?php endif; ?>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。