For the main loop, you use query_posts
http://codex.wordpress.org/Function_Reference/query_posts
For secondary loops, use get_posts
http://codex.wordpress.org/Template_Tags/get_posts
Read through the documentation. You should find what you’re looking for.
Peter_L, I think you got it. I’m playing with the new code now.
No, that’s wrong. You can call all the different category names in one query_posts and then use different query_posts parameters to do what you want. Read through this:
http://codex.wordpress.org/Function_Reference/query_posts
Sorry, I think we are posting at the same time. After you sent your links, it was the insight that I needed. I wanted to get rid of that embarrassing code before anyone else saw it.
<?php
$args=array(
'category__in' => array(1,2,3,4),
'posts_per_page' => 4,
'orderby' => 'post_date',
'order' => 'DESC'
);
$wp_query->query($args);
?>
I have this, but here is where I am lost. Is it possible to show 1 post from each category, and whichever post is the most recent has to be at top? For instance, only one post is shown for category 1,2,3,4. But category 2 has the most recent post and needs to be at the top. I’m wondering if it’s even possible doing it this way.
It might be possible this way but I don’t think so.
What you can do is use above code and put ‘numberposts’ to 1. That would give you the most recent post.
Then try and get the category that most is in and save it in a variable. Next you run 3 get_posts and you use above id as a negative.
Thank you for your help. I decided to do things a different way and restructure the design. The solution I came up with is easier and makes more sense.