neodjandre — 2013-03-25T12:24:23-04:00 — #1
Hello all, I am implementing the popular Nivo Slidebar on my wordpress sidebar and I would need some help with my code.
Basically I just want to show 5 slides which always contain the latest post from each of my review types namely:
I am having trouble figuring the code that needs to go on the loop... I figured out CSS, Jquery - I just need the php code which can do the above.
I need to show the image and post title.
Any help would be much appreciated!
force — 2013-03-25T13:52:58-04:00 — #2
Use WP_Query and the post_type attribute. The post_type will be whatever string you used when you registered your custom post type.
neodjandre — 2013-03-25T16:00:20-04:00 — #3
Hi Force Flow, this is very useful but i couldnt find an example that tells me how to show only 1 post from each of the 5 custom post types.. any help with the actual syntax?
force — 2013-03-25T16:53:59-04:00 — #4
The only method that I can think of is to do 5 different WP_Queries and set the "posts_per_page" attribute to 1 for each of them.
neodjandre — 2013-03-25T18:09:06-04:00 — #5
thanks! would your suggestion use less resources than 1 WP Query which lists the 5 latest posts with the tag "latest-posts" ? i.e. I am going to tag all posts with "latest-posts" and the Query will pick the last 5..
force — 2013-03-26T00:43:20-04:00 — #6
Database queries are cheap. They're designed to run and return results quickly.
Your proposed method puts a lot of burden on you to manage the content manually for a feature in your template that should be automatic.