Wordpress随机邮政编码仅显示一位作者的帖子

时间:2014-01-10 05:50:11

标签: php html wordpress

我有一段代码可以在帖子下显示随机帖子。但是这段代码只向我展示了该帖子的作者的帖子。 怎么了?

    <?php $posts = get_posts('orderby=rand&numberposts=3'); foreach($posts as $post) { ?>
        <div class="col-sm-12 col-md-6 col-xs-12 col-lg-4">
            <div class="thumbnail">
                <article>
                    <a href="<?php the_permalink();?>"><?php the_post_thumbnail('photo-thumbnail') ?></a>
                    <div class="caption">
                        <a href="<?php the_permalink();?>">
                            <h3 style="font-weight:bold; margin-top: 0px; line-height: 1.3;"><?php the_title(); ?></h3>
                        </a>
                    </div>
                </article>
            </div>
            <div class="thumbnailFooter">
                <div class="pull-left" style="margin-bottom: 4px;"><?php echo get_avatar( get_the_author_meta( 'ID' ), 32 ); ?></div>
                <div class="smallFont pull-left" style="margin-left: 5px; width: 240px;"><span class="blue bold"><?php the_author(); ?></span></div>
                <div class="verySmallFont pull-left" style="margin-left: 5px; margin-top: -3px;">en <span class="bold gray"><?php the_category(none); ?></span> el <?php the_time('j F, Y'); ?> </div>
            </div>
        </div>
        <?php } ?>

1 个答案:

答案 0 :(得分:0)

我将再次询问我的答案,其他帖子有更多数据

Can't reset query to show ramdom post after firs loop Wordpress