duan48961411
duan48961411
2013-12-02 17:28
浏览 24
已采纳

将帖子数添加到自定义帖子归档页面。

I am using Wordpress and the Roots Template. I have created an archive page to show member profiles. - its just index.php saved out as archive-members.php so it gets the member posts, but I don't know how to change the number it displays. I want it to display all. its not using any custom post type query, its just an archive of this post-type slug

Here is my page code.

    <div class="purple row">
  <div class="container">
    <div class="col-lg-12">
      <?php get_template_part('templates/page', 'header'); ?>
    </div>
  </div>
</div>

<?php if (!have_posts()) : ?>
  <div class="alert alert-warning">
    <?php _e('Sorry, no results were found.', 'roots'); ?>
  </div>
  <?php get_search_form(); ?>
<?php endif; ?>

<div class="row pagecontent">
  <div class="container">
    <?php while (have_posts()) : the_post(); ?>
    <div class="col-sm-3">
      <?php get_template_part('templates/members', get_post_format()); ?>
    </div>

  <?php endwhile; ?>

  <?php if ($wp_query->max_num_pages > 1) : ?>
</div>
</div>

  <div class="container">
    <div class="col-lg-12">
       <nav class="post-nav">
    <ul class="pager">
      <li class="next"><?php next_posts_link(__('Next Page &rarr;', 'roots')); ?></li>
      <li class="previous"><?php previous_posts_link(__('&larr; Previous Page', 'roots')); ?></li>
    </ul>
  </nav>
    </div>
  </div>


<?php endif; ?>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongmi4927
    dongmi4927 2013-12-02 17:54
    已采纳

    I believe this question has already been answered here.

    The answer in that thread links to the WordPress codex on using the query_post() function.

    That, or as someone else in the thread states, you can try changing the settings in the admin interface (settings -> reading). There, you'll see a box that allows you to change how many posts are displayed on a page.

    点赞 评论

相关推荐