WordPressで、
category.phpを使用し、カテゴリーページのNEWSを表示させています。
http://test.second-order.jp/news
PageNaviというプラグインを使い、
<?php wp_pagenavi(); ?>上記設置し、
2ページ目に遷移できるようにしましたが、
http://test.second-order.jp/news/page/2/
2ページ目がヘッダーとフッターしか表記されません。
パーマリンクの設定は以下になっています。
/%category%/%postname%/
1ページ目のデザインと同じにし、
10個目以降を2ページ目に同じデザインで表示させたいと考えております。
<?php get_header(); $theID = get_the_ID(); ?> <div id="news-line"> <div class="container-fluid news-text"> <div class="row"> <div class="smp-1"> <h2><span>NEWS一覧</span></h2> </div> <div class="col-xs-12 col-sm-12 col-sm-offset-0 col-md-6 col-md-offset-3"> <div class="topthirty"> <?php $args = array( 'posts_per_page' => 10, 'post_type' => 'post', 'exclude' => $theID ); $posts = get_posts( $args ); foreach ( $posts as $post ) : setup_postdata( $post ); $href = get_permalink($post->ID); $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'post-thumb' ); $img_url = $thumb['0']; $excerpt = $post->post_excerpt ? mb_substr(strip_tags($post->post_excerpt), 0, 120) : mb_substr(strip_tags($post->post_content), 0, 120); ?> <div class="row wht news-line"> <div class="col-xs-12 col-sm-12 col-md-3"> <p class="days"><?php the_time( get_option( 'date_format' ) ); ?></p> </div> <div class="col-xs-12 col-sm-12 col-md-6"> <a href="<?php echo esc_url($href); ?>"> <h3 class="news4 bold1"><?php echo $post->post_title; ?></h3> </a> <p class="next-p text-justify"> <?php echo wp_trim_words( get_the_content(), 100, '...' ); ?> </p> </div> <div class="col-xs-12 col-sm-12 col-md-3"> <a href="<?php echo esc_url($href); ?>"> <div class="pic"> <img src="<?php echo esc_url($img_url); ?>" alt="<?php echo $post->post_title; ?>" class="img-responsive same-size"/> </div> </a> </div> </div> <?php endforeach; wp_reset_postdata(); ?> <div class="view2"> <?php wp_pagenavi(); ?> </div> </div> </div> </div> </div> </div> <?php get_footer(); ?>
何卒よろしくお願い致します。
回答1件
あなたの回答
tips
プレビュー