Title: andyasher55's Replies | WordPress.org

---

# andyasher55

  [  ](https://wordpress.org/support/users/andyasher55/)

 *   [Profile](https://wordpress.org/support/users/andyasher55/)
 *   [Topics Started](https://wordpress.org/support/users/andyasher55/topics/)
 *   [Replies Created](https://wordpress.org/support/users/andyasher55/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/andyasher55/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/andyasher55/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/andyasher55/engagements/)
 *   [Favorites](https://wordpress.org/support/users/andyasher55/favorites/)

 Search replies:

## Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Display 4 more posts from same category](https://wordpress.org/support/topic/display-4-more-posts-from-same-category/)
 *  [andyasher55](https://wordpress.org/support/users/andyasher55/)
 * (@andyasher55)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/display-4-more-posts-from-same-category/#post-1136232)
 * Doh! Nevermind, I stumbled on a solution.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Display 4 more posts from same category](https://wordpress.org/support/topic/display-4-more-posts-from-same-category/)
 *  [andyasher55](https://wordpress.org/support/users/andyasher55/)
 * (@andyasher55)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/display-4-more-posts-from-same-category/#post-1136231)
 * Michael,
 * I’m trying hard to modify your fabulous patch…A similar situation to souverian.
 * I’m trying to show more posts from the selected category, but am using a custom
   field for the thumbail.
 * [http://nicolasheller.com/test/?p=1](http://nicolasheller.com/test/?p=1)
 * Here is the thumbnail code:
 *     ```
       <!-- Begin Thumbnail -->
       				    <?php $postimageurl = get_post_meta($post->ID, 'post-img', true);
       				    if ($postimageurl) {
       				    ?>
       					  <a href="<?php the_permalink($cat_post->ID); ?>" rel="bookmark"><img src="<?php echo $postimageurl; ?>" alt="thumbnail" /></a>
       				    <?php } else { ?>
       					  <a href="<?php the_permalink($cat_post->ID); ?>" rel="bookmark"><img src="<?php bloginfo('template_url'); ?>/images/_.jpg" alt="thumbnail" /></a>
       				    <?php } ?>
       				    <!-- End Thumbnail -->
       ```
   
 * How would I adapt this to what you provided?:
 *     ```
       <?php
       			global $post;
       			$cat_ID=array();
       			$categories = get_the_category(); //get all categories for this post
       			  foreach($categories as $category) {
       			    array_push($cat_ID,$category->cat_ID);
       			  }
       			  $args = array(
       			  'orderby' => 'date',
       			  'order' => 'DESC',
       				'post_type' => 'post',
       				'numberposts' => 8,
       				'post__not_in' => array($post->ID),
       				'category__in' => $cat_ID
       			  ); // post__not_in will exclude the post we are displaying
       			    $cat_posts = get_posts($args);
       			    $out='';
       			      foreach($cat_posts as $cat_post) {
       			          $out .= '<h1>';
       			          $out .=  '<a href="'.get_permalink($cat_post->ID).'" title="'.wptexturize($cat_post->post_title).'">'.wptexturize($cat_post->post_title).'</a></h1>';
       			      }
       			    $out = '<ul class="cat_post">' . $out . '</ul>';
       			    echo $out;
       			?>
       ```
   
 * Thanks so much!

Viewing 2 replies - 1 through 2 (of 2 total)