新着一覧ページにカスタム投稿分を入れたとき、page Naviが出ない
-
以下のようにしてるのですが、pagenaviが出ません。
category-info.phpに書き込んでいます。<h2 class="entry-title"><?php single_cat_title(); ?></h2> <div id="info"> <?php $args = array( 'post_type' => array('post', 'gallery'), 'paged' => $paged, 'posts_per_page' => 20 ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ): ?> <dl> <?php while ( $the_query->have_posts() ) : $the_query->the_post(); $post_type = $post->post_type; $cat = get_the_category(); $newsclass = ( ! empty($cat[0]) ) ? $cat[0]->category_nicename : ''; $newsclass = ( $post_type == 'gallery' ) ? 'gal' : $newsclass; ?> <dt><?php the_time('Y.m.d'); ?></dt> <dd class="<?php echo $newsclass; ?>"><a href="<?php the_permalink(); ?>"><?php the_title() ?></a></dd> <?php endwhile; ?> </dl> <?php endif; wp_reset_postdata(); ?> </div> <?php if(function_exists('wp_pagenavi')): ?> <div class="pagenavi mt20 center"> <?php wp_pagenavi(); ?> </div> <?php endif; ?> </div>
- トピック「新着一覧ページにカスタム投稿分を入れたとき、page Naviが出ない」には新たに返信することはできません。