Ready to get started?Download WordPress


help with query_posts and the_loop (5 posts)

  1. aylia
    Posted 8 years ago #

    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!


  2. moshu
    Posted 8 years ago #

    If you want to display posts by category you may want to take a look at this thread (and tweak the solution offered there)

  3. mylagoon
    Posted 8 years ago #

    Have you had a look at the WP Codex?

    EDIT: You beat me this time Moshu, you don't type that slow after all. But I'll get you next time! ;)

  4. aylia
    Posted 8 years ago #

    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

  5. aylia
    Posted 8 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic