小编Met*_*her的帖子

Wordpress get_posts()发布限制

我正在使用wordpress的功能the_excerpt()。它工作正常,但结果仅显示我帖子的5个。如何使其显示所有帖子,而不是仅显示5个最新帖子?

我的代码:

<?php

    $lastposts = get_posts();

    foreach ( $lastposts as $post ) :

            setup_postdata( $post ); ?> 

            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

            <p style="font-size:12;"><em>Post date: <?php the_date(); ?></em></p>

            <?php the_excerpt() ?>

            <a href="<?php echo get_permalink(); ?>"> Read more...</a>

            wp_reset_postdata();

    php endforeach; ?>
Run Code Online (Sandbox Code Playgroud)

wordpress

1
推荐指数
1
解决办法
4998
查看次数

标签 统计

wordpress ×1