Title: Custom post listings
Last modified: August 19, 2016

---

# Custom post listings

 *  [gili](https://wordpress.org/support/users/gili/)
 * (@gili)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/custom-post-listings/)
 * Hello gurus,
 * I need to display two pages:
 * 1. A random list of posts that have no comments + its excerpts.
 * 2. A list of the latest 25 added posts + its excerpts
 * Can you please provide some code or refer me to a plugin that i can use to do
   that .
 * Thanks a bunch in advance,
    Gili

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

 *  [Doodlebee](https://wordpress.org/support/users/doodlebee/)
 * (@doodlebee)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/custom-post-listings/#post-1145789)
 * 1) show ten most recent excerpts, random order
 *     ```
       <?php
       query_posts('showposts=10&order=RAND');
       if(have_posts()): while(have_posts()): the_post(); ?>
       <?php the_excerpt(); ?>
       <?php endwhile; endif; ?>
       ```
   
 * 2) show 25 most recent posts
 *     ```
       <?php
       query_posts('showposts=25');
       if(have_posts()): while(have_posts()): the_post(); ?>
       <?php the_content(); ?>
       <?php endwhile; endif; ?>
       ```
   
 * more info on queries [here](http://codex.wordpress.org/User:JamesVL/query_posts).
 *  Thread Starter [gili](https://wordpress.org/support/users/gili/)
 * (@gili)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/custom-post-listings/#post-1145861)
 * Thanks.
 * I didn’t explain myself correctly about the first query i need:
 * I need to display only posts which have no comments.
 * The question is how to tweak the first query to display only posts with no comments.
 * Thanks,
    Gili
 *  [Doodlebee](https://wordpress.org/support/users/doodlebee/)
 * (@doodlebee)
 * [16 years, 10 months ago](https://wordpress.org/support/topic/custom-post-listings/#post-1145916)
 * I suppose you could check to see if comments are associated with the post, but
   that would require a custom function. You’d probably have to query the database
   first because there’s no existing parameter for checking if there’s comments 
   or not (not that I’m aware of anyway) and use that to add to your query. I don’t
   know of any plugins that do this, but a [forum search](http://wordpress.org/search/show+posts+with+no+comments?forums=1)
   comes up with a bunch of stuff. Maybe one of those can help you?

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

The topic ‘Custom post listings’ is closed to new replies.

 * 3 replies
 * 2 participants
 * Last reply from: [Doodlebee](https://wordpress.org/support/users/doodlebee/)
 * Last activity: [16 years, 10 months ago](https://wordpress.org/support/topic/custom-post-listings/#post-1145916)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
