Grow your CSS skills. Land your dream job.

most recent post from each selected categories

  • cjk
    # May 17, 2009 at 4:56 pm

    Hi,

    I am using the following code on my static home page outside of my wordpress installation. This is working great, I have it set to grab the 3 most current posts (from all categories) from my blog. However, I wonder if anyone can help me figure out how to have it only grab the 1 most current post in each of 3 select categories – still resulting in 3 excerpts but only the most recent from each of 3 select categories.

    Possible?

    Code:

    The url is: http://www.krowchukdressage.com

    Cheers!
    Chris

    # May 17, 2009 at 6:03 pm

    Hi Chris,

    I don’t have a quick answer for you. Here’s some info that may help you figure it out:

    The code you supplied is the WordPress Loop that spits out the content of your posts. The Posts that you display is actually requested earlier.

    You should be able to add an if statement inside the loop like this:

    Code:
    < ?php if (in_category('3') && is_home() ) continue; ?>

    You’ll have to customize it to look for a variable that is only set if that category has already been filled up… make sense?

    You could probably do three separate "Loops" that only spit out one post, and make sure that post is from a certain category.

    I hope that points you in the right direction.
    Ashton

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".