お世話になります。
wordpressのカスタム投稿について質問がございます。
新しく作ったカスタム投稿を固定ページに一覧表示したのですが、ページネーションがうまく動作しません。
具体的には、
固定ページ : page-campgallery.php
カスタム投稿 スラッグ名 : campgallery
テーマ : Twenty Fifteen Child
ページネーション系のプラグインは使わず
ページネーションを画面上に表示をさせることはできたが、次ページのボタンを押すとページが見つかりませんと表示されます。
URLは『http://localhost:8888/0000/campgallery/』→『http://localhost:8888/0000/campgallery/page/2/』になっている。
どなたか解決法が分かる方ご指摘をお願い致します。
php
1<?php 2 /* 3 Template Name: campgallery 4 */ 5 6 get_header(); ?> 7 8<div id="primary" class="content-area"> 9 <main id="main" class="site-main" role="main"> 10 11 <?php 12 $wp_query = new WP_Query(); 13 $param = array( 'posts_per_page' => '1', 14 'post_type' => 'campgallery', 15 'post_status' => 'publish', 16 'paged' => get_query_var( 'paged' ) ); 17 $wp_query->query( $param ); 18 while( $wp_query->have_posts() ) : $wp_query->the_post(); 19 get_template_part( 'content-campgallery', 'page' ); 20 endwhile; 21 wp_reset_postdata(); 22 the_posts_pagination( array( 'prev_text' => __( 'Previous page', 'twentyfifteen' ), 23 'next_text' => __( 'Next page', 'twentyfifteen' ), 24 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>', ) ); 25 ?> 26 27 </main><!-- .site-main --> 28</div><!-- .content-area --> 29 30<?php get_footer(); ?> 31
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/07/09 04:28