普通网友 2013-12-02 17:28
浏览 25
已采纳

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

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 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)