$ posts = get_posts Wordpress帖子不令人耳目一新

时间:2015-09-16 18:15:43

标签: php wordpress

我有以下代码用于从我的博客中获取最新帖子,但是当我发布新博客帖子时它不会更新。有什么想法吗?

            <?php
            $posts = get_posts('numberposts=2&order=ASC&orderby=post_title');
            foreach ($posts as $post) : setup_postdata( $post ); ?>
            <?php the_post_thumbnail( 'medium' ); ?><br>
            <strong><?php the_title(); ?> </strong><br>
            <small><?php the_date(); echo "<br />"; ?></small>   
            <?php the_excerpt(); ?> 
            <hr>
            <?php
            endforeach;
            ?>

1 个答案:

答案 0 :(得分:0)

通过更改以下内容进行修复:

$ posts = get_posts('numberposts = 2&amp; orderby = date ');

相关问题