single.phpでのページ分割について
-
現在「topics」(page-topics.php)としたページに、以下のループを使って投稿を表示しています。
<!--▽ループ--> <?php $paged = get_query_var('paged'); ?> <?php query_posts('posts_per_page=1&category_name=topics&paged='. $paged); if (have_posts()) : while (have_posts()) : the_post(); get_template_part('content'); endwhile; endif; ?> <?php wp_reset_query(); ?> <!--△ループ-->
この記事の下に、さらに以下のループで過去記事のタイトルを10件抜粋し
超えた分はページ送りするようにしています。<!--▼一覧--> <section class="archive_topics_list"> <section class="article"> <div class="article_header"> <h2><a href="#">BACK NUMBER</a></h2> </div><!--/article_header--> <ul class="entry_list"> <?php $paged = get_query_var('paged'); ?> <?php query_posts('posts_per_page=10&cat=4&post_type=post&paged='.$paged); ?> <?php if (have_posts()) :while (have_posts()): the_post(); ?> <li><?php the_time('m月d日(D)'); ?> <a>" rel="bookmark"> <?php the_title(); ?></a> </li> <?php endwhile; endif; ?> </section><!--/article--> </section><!-- /archive_topics_list --> <div id="pagenav"> <?php if(function_exists('wp_paginate')) {wp_paginate();} ?> </div><!--/pageNav--> <?php wp_reset_query(); ?> <!--▲一覧-->
この10件の記事一覧をsingle.phpでも使いたいのですが
色々試してもどうしてもうまくいきません。記事部分のループは<?php if (have_posts()) : while (have_posts()) : the_post(); get_template_part('content'); endwhile; endif; ?>
としてみましたが、これだと投稿一覧から個別に記事を見ることはできますが
記事一覧がページ送りできず、最新10件表示のままです。素人ながらなんとかここまで調べて作ってみましたが、行き詰ってしまいました。
どこが間違ってるのか、お力を貸していただければと思います。よろしくお願いします。
5件の返信を表示中 - 1 - 5件目 (全5件中)
5件の返信を表示中 - 1 - 5件目 (全5件中)
- トピック「single.phpでのページ分割について」には新たに返信することはできません。