【问题标题】:Pagination in post loop. Wordpress后循环中的分页。 WordPress
【发布时间】:2016-04-11 04:41:56
【问题描述】:

如何将每个站点限制为 20 个帖子分页 附言。我在 content-postarchives.php 中做了这个

<?php
$args = array( 'posts_per_page' => 20 );
$the_query = new WP_Query( $args );?>
<?php if ( $the_query->have_posts() ) : ?>
  <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    <li>
    <h4><a class="text_aktualnosci" href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
        <span class="data_dodania_arch"><?php _e('Data dodania: '); ?><strong><?php echo get_the_date(); ?></strong></span>
    </h4>
    </li>
  <?php endwhile; ?><!-- end of the loop -->
  <!-- put pagination functions here -->
<?php else:  ?>
<p><?php _e( 'Przepraszamy, brak aktualności' ); ?></p>
<?php endif; ?>

【问题讨论】:

    标签: wordpress loops pagination posts


    【解决方案1】:

    您可以在 wp admin 中进行操作:

    进入设置菜单阅读 然后更改每页的帖子数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-04-18
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 2015-11-27
      • 2012-09-20
      • 1970-01-01
      相关资源
      最近更新 更多