I was wondering how to get the title/img/content of some random article, but from specific category.
For an example:
I have 3 categories A,B and C and I have a image slider on my blog.
I want to show on the slider ONLY those articles who are in category A, not B and C.
How can I make that happen ? 🙂
The below example should get you started. It basically calls the get_posts() function with some criteria.
Then we run a foreach on the returned posts to do what we want. You don’t have to run a foreach, in the below example $rand_posts will hold an array post objects with which you can do what you want.
You can take a look at the codex and change the arguments, criteria, to whatever you’d like.
WordPress Codex – Get Posts