我的问题是我正在显示“事件”类别中的一些帖子。然后稍后在同一页面上,我想显示来自“spiller”类别的随机帖子,并且效果很好。它得到一个随机帖子,显示标题、缩略图,但是当我说显示 the_content(或 the_excerpt)时,它会显示“事件”类别中帖子的所有内容(或摘录)。请帮我解决这个问题!
<div class="well span6 Padding10">
<h4 class="titleFont MarginBottom20">KOMMENDE BEGIVENHEDER</h4>
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'category_name' => 'events', // Change these category SLUGS to suit your use.
'paged' => $paged
);
query_posts( $args ); ?>
<ul>
<?php
while ( have_posts() ) : the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>"><strong><?php the_title(); ?></strong></a>
</li>
<?php endwhile; ?>
</ul>
</div>
<div class="span6 well" style="height: 250px;"><h4 class="titleFont">SPILLER HIGHLIGHT</h4>
<div class="row-fluid">
<?php
$args = array(
'numberposts' => 1,
'orderby' => 'rand',
'category_name' => 'spiller'
);
$rand_posts = get_posts( $args );
foreach ( $rand_posts as $post ) : ?>
<div class="span5"><?php the_post_thumbnail( array( 150, 150 ) ); ?></div>
<div class="span6 MarginTop10">
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
<!-- THIS IS WHERE IT MESSES UP: --><?php the_content(); ?>
</div>
<?php endforeach; ?>
</div>
</div>