我已经找到了一个解决方案,并根据我的需要对其进行了修改,也许有人也在寻找相同的解决方案,所以你可以这样做:
<?php
if ( is_single() ) {
  $categories = get_the_category();
  if ($categories) {
    foreach ($categories as $category) {
      $cat = $category->cat_ID;
      $args=array(
        \'cat\' => $cat,
        \'post__not_in\' => array($post->ID),
        \'posts_per_page\'=>3,
        \'offset\'=>1,
        \'caller_get_posts\'=>1
      );
      $my_query = null;
      $my_query = new WP_Query($args);
      if( $my_query->have_posts() ) {
        echo \'<h2>More in this section</h2>\';
        while ($my_query->have_posts()) : $my_query->the_post(); ?>
        <div class="cat-related-articles">
<?php the_post_thumbnail(\'thumb\'); ?>          
<p class="sidebar-article-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link 
to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php the_excerpt(5); ?>  
          </div>
         <?php
        endwhile;
      } //if ($my_query)
    } //foreach ($categories
  } //if ($categories)
  wp_reset_query();  // Restore global post data stomped by the_post().
} //if (is_single())
?>
 现在,我的问题是:
\'posts_per_page\'=>3,
\'offset\'=>1,
 它们不起作用。我正在尝试省去,而不是显示我当前所在的帖子。请记住,如果我单击一篇文章,侧栏中的这段代码将显示同一类别中另外3篇文章的标题、缩略图和摘录。
所以how do I make it not to display the post 我当前正在查看?
另一件事,我的文章属于两个类别,代码将显示每个类别的帖子。How do I get rid of this?!