Forums

[resolved] category list with posts (4 posts)

  1. hcvitto
    Member
    Posted 5 months ago #

    Hi
    i need to list in my homepage some category and for each of them to list the first 10 posts, for the first category the layout must be a little different, like this:
    category 1 -> 10 posts (with title and an image)
    category 2 (and 3,4,5) -> 10 posts (only with title)

    For the moment i did it with 5 query_posts, resetting it at the end of each loop.
    Do you think is this the right way? or maybe is there any other more convenient way of doing it? Or the only alternative is to use a plugin?

    Thanks
    Vitto

  2. Peter_L
    Member
    Posted 5 months ago #

    No, not the right way.

    Read this on secondary loops
    http://codex.wordpress.org/Function_Reference/query_posts#Secondary_Loops

    use get_posts

  3. hcvitto
    Member
    Posted 5 months ago #

    hi peter
    thanks, it seems much better..but just to bu sure: do you suggest to use multiple get_posts, right?

  4. Peter_L
    Member
    Posted 5 months ago #

    yes

Reply

You must log in to post.

About this Topic