[resolved] Get posts from specific category in dated order (3 posts)

  1. creativelifeform
    Posted 6 years ago #

    Hi all,

    I am doing a custom wordpress design that has 3 columns on the front page. Yeah, 3 columns I know...why did I pitch this design again?

    Anyway, I need to get the 6 latest posts from a specific category and display them on the page in a 3 column 2 row layout. I need the posts which appear in the 3rd column to get a special class which clears their right margin.

    Any ideas on how to best do this? I was thinking the easiest way for me would be to forget about the loop and just get the 6 latest posts from that category individually, but is there a way to do this? For example get the latest post, then get the one after that, then the one after that, but individually, not in a loop. That way I can put them inside of divs which have custom classes.

    I suspect there must be some PHP magic that will do this. I'll keep searching in the mean time.

  2. MichaelH
    Posted 6 years ago #

  3. creativelifeform
    Posted 6 years ago #

    Hi MichaelH, thanks for that. I did it using modulus. Works like a charm, thanks anyway!

Topic Closed

This topic has been closed to new replies.

About this Topic