Title: help with query_posts and the_loop
Last modified: August 18, 2016

---

# help with query_posts and the_loop

 *  [aylia](https://wordpress.org/support/users/aylia/)
 * (@aylia)
 * [20 years, 4 months ago](https://wordpress.org/support/topic/help-with-query_posts-and-the_loop/)
 * Hello, I’m trying to create a front page like this:
 * Cat 1: 1 article excerpt + then 5 headline links
    Cat 2: 5 headline links Cat
   2: 5 headline links etc…
 * I previously used get_posts but this doesn’t seem to work with the new wordpress,
   so I think I need to use query_posts
 * Anyone know how to achieve this with query_posts? I’m totally confused!
 * Thanks

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

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [20 years, 4 months ago](https://wordpress.org/support/topic/help-with-query_posts-and-the_loop/#post-335486)
 * If you want to display posts by category you may want to take a look at this 
   thread (and tweak the solution offered there)
    [http://wordpress.org/support/topic/38046?replies=31](http://wordpress.org/support/topic/38046?replies=31)
 *  [mylagoon](https://wordpress.org/support/users/mylagoon/)
 * (@mylagoon)
 * [20 years, 4 months ago](https://wordpress.org/support/topic/help-with-query_posts-and-the_loop/#post-335487)
 * Have you had a look at the WP Codex?
    [http://codex.wordpress.org/Template_Tags/query_posts](http://codex.wordpress.org/Template_Tags/query_posts)
   [http://codex.wordpress.org/Template_Tags](http://codex.wordpress.org/Template_Tags)
 * EDIT: You beat me this time Moshu, you don’t type that slow after all. But I’ll
   get you next time! 😉
 *  Thread Starter [aylia](https://wordpress.org/support/users/aylia/)
 * (@aylia)
 * [20 years, 4 months ago](https://wordpress.org/support/topic/help-with-query_posts-and-the_loop/#post-335489)
 * I have looked at the codex but I don’t understand it!
 * That other link looks very useful though…I will give it a go.
 * Thanks for your help
 *  Thread Starter [aylia](https://wordpress.org/support/users/aylia/)
 * (@aylia)
 * [20 years, 4 months ago](https://wordpress.org/support/topic/help-with-query_posts-and-the_loop/#post-335737)
 * Does anyone else have any suggestions for this?
 * In the link suggested the solution means all categories are linked to on the 
   front page – I only want 5 out of about 36!
 * The codex isn’t particularly helpful to someone not familiar to php. I’ve found
   a way to link to one category, but not 5, and not 5 that are all laid out in 
   a different way..
 * I used to achieve this using
    <?php $posts =get_posts(‘order=ASC&category=2&orderby
   =date&offset=0&numberposts=1’); foreach ($posts as $post) : start_wp(); ?> < 
   content> <?php endforeach; ?>
 * and then laying out each category individually, but this causes errors now I’ve
   upgraded.
 * any ideas gratefully received

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

The topic ‘help with query_posts and the_loop’ is closed to new replies.

## Tags

 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [aylia](https://wordpress.org/support/users/aylia/)
 * Last activity: [20 years, 4 months ago](https://wordpress.org/support/topic/help-with-query_posts-and-the_loop/#post-335737)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
