Wordpressで固定ページで記事一覧を作成していますが、ページ送りが上手くいかないようです。
ありとあらゆる方法を試しましたが2ページ目以降が2ページ目と同じ表示になってしまいます。
funcutions.phpでの設定もやってみましたがこれも上手くいきません。
管理画面での設定は特に問題はないようですので、あとはコードしか考えられないのですが、
詳しい方がいらっしゃいましたらアドバイスをお願いいたします。
足りない情報があれば補足いたします。
コードは以下のようになります。
<!-- ブログ記事一覧 --><div class="article"> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $the_query = new WP_Query(array( "post_type" => "post", "post_status" => "publish", "posts_per_page" => "6", "offset" => "6", 'paged' => $paged )); if ($the_query->have_posts()) : ?> <?php while ($the_query->have_posts()) : $the_query->the_post(); ?> <?php setup_postdata($post); ?> <div class="item item1"> <div class="item_inner"> <ion-icon name="checkbox"></ion-icon> <h3><?php the_title(); ?></h3> </div> <div class="kiji"> <div class="front-photo"> <?php the_post_thumbnail(); ?> </div> <p><?php the_excerpt(); ?></p> </div> <div class="readmore"> <p><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>Read More">Read More »</a></p> </div> <div class="date_cate"> <p class="date"> 投稿日付 <?php the_time('Y.m.d') ?> </p> <p class="category"> 投稿カテゴリ <?php the_category('|') ?> </p> <p class="comments"> コメント <a href="<?php comments_link(); ?>"><?php comments_number('(0)', '(1)', '(%)'); ?> </a> </div> </div> <?php endwhile; ?> <?php endif; ?> <!-- pagenation --> <div class="pagenation"> <?php if ($the_query->max_num_pages > 1) { echo paginate_links(array( 'base' => get_pagenum_link(1) . '%_%', 'format' => '/page/%#%/', 'current' => max(1, $paged), 'mid_size' => 1, 'total' => $the_query->max_num_pages )); } wp_reset_postdata(); ?> </div><!-- /pagenation --> </div>
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/07/14 06:33
2022/07/15 11:01 編集