0
게시물 아래에 임의의 게시물을 표시하는 코드가 있습니다. 그러나이 코드는 해당 게시물의 작성자가 보낸 게시물의 내용 만 표시합니다. 뭐가 잘못 되었나요?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 } ?>
다른 게시물에 다시 더 많은 데이터와 내 대답을 요청할 것입니다 그리고 그 임의의 게시물을 집어 들고 저자. 그래서 임의의 게시물/기사를 원하는 부분에 대한 쿼리를 재설정하고 새 쿼리를 작성합니다. – Ljubisa
어떻게 쿼리를 재설정 할 수 있습니까? :) –
php wp_reset_query();를 사용했습니다. ?> 루프 endif 후하지만 작동하지 않습니다. –