Title: post sorting in slide
Last modified: August 20, 2016

---

# post sorting in slide

 *  [MyView Studio](https://wordpress.org/support/users/myview/)
 * (@myview)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/post-sorting-in-slide/)
 * I have code:
 *     ```
       <?php<br />
       $slidecatID = get_cat_id(get_option('scar_gldcat'));<br />
       $slidecount = get_option('scar_gldct');</p>
       <p>$my_query = new WP_Query('cat=5'. $slidecatID . '&showposts=6' . $slidecount . '$orderby=ran');<br />
       while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;<br />
       ?>
       ```
   
 * I want to sort post that will be showing from category ID=5
    I use to do that
   this ==> ‘cat=5’ There will be 6 post, I use to do that this ==> ‘&showposts=
   6’ everything to this point is working
 * But I want show only recent post, not random.
    want to change this one ==> ‘$
   orderby=ran’ I want sort the post by date, that the last 6 post from category
   id 5 will be visible on each page where the slide is included. Anyone know how
   to do it ?? Really need a help . . .

The topic ‘post sorting in slide’ is closed to new replies.

## Tags

 * [categories](https://wordpress.org/support/topic-tag/categories/)
 * [orderby](https://wordpress.org/support/topic-tag/orderby/)
 * [post](https://wordpress.org/support/topic-tag/post/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [MyView Studio](https://wordpress.org/support/users/myview/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/post-sorting-in-slide/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
