wordpressの固定ページで記事の一覧を作成しています。
固定ページでページャーを使いたいのですがループより下でないとページャーが表示されません。
.wrap1のすぐ下にもページャーを表示させるには、どのようにしたら正解なのでしょうか…?
.paginationが表示させてたいページャーです。
php
1<div class="wrap1"> 2 3 <!-- ここにページャーを表示させたいが、ページャーが表示されない --> 4 5 <?php 6 $paged = (int) get_query_var('paged'); 7 $args = array( 8 'posts_per_page' => 3, 9 'paged' => $paged, 10 'orderby' => 'post_date', 11 'order' => 'DESC', 12 'post_type' => 'post', 13 'post_status' => 'publish' 14 ); 15 $the_query = new WP_Query($args); 16 if ( $the_query->have_posts() ) : 17 while ( $the_query->have_posts() ) : $the_query->the_post(); 18 ?> 19 20 <div class="blog_post"> 21 <h2 class="title"><?php the_title(); ?><span><?php echo get_the_date('Y年m月d日'); ?></span></h2> 22 <div class="grad-wrap"> 23 <div class="grad-trigger"><img src="https://placehold.jp/150x150.png"></div> 24 <div class="grad-item"> 25 <?php the_content(); ?> 26 </div> 27 </div> 28 </div> 29 <?php endwhile; endif; ?> 30 31 <div class="pagination"> 32 <div class="pagination-box"> 33 <?php 34 if ($the_query->max_num_pages > 1) { 35 echo paginate_links(array( 36 'base' => get_pagenum_link(1) . '%_%', 37 'format' => '/page/%#%/', 38 'current' => max(1, $paged), 39 'class' => 'pagination', 40 'prev_text' => '前へ', 41 'next_text' => '次へ', 42 'type' => 'list', 43 'total' => $the_query->max_num_pages 44 )); 45 } 46 ?> 47 </div> 48 </div> 49 </div> 50</div>
お分かりになられる方見えましたら、よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/12/05 06:39
2018/12/05 06:40