繁体   English   中英

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

[英]Adding number of posts to custom post archive page.

我正在使用Wordpress和根模板。 我创建了一个存档页面以显示成员个人资料。 -仅将index.php保存为archive-members.php,以便获取会员的帖子,但我不知道如何更改其显示的数字。 我希望它显示全部。 它不使用任何自定义帖子类型查询,而只是此帖子类型子句的存档

这是我的页面代码。

    <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; ?>

我相信这个问题已经在这里回答了。

该线程中的答案通过使用query_post()函数链接到WordPress Codex

那,或者作为其他处于线程状态的人,您可以尝试在管理界面中更改设置(设置->阅读)。 在那里,您会看到一个框,可让您更改页面上显示的帖子数量。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM