How do I display 1 random article from multiple categories?
Okay currently I use the following code to display a random article from the category called fish:
<?php $my_query = new WP_Query(“category_name=Feesten&showposts=$artsee_homepage_featured&orderby=rand”);
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate = $post->ID; ?>
<?php $thumb = get_post_meta($post->ID, ‘Featured’, $single = true); ?>
Thought this is working fine, I do want to add 2 extra categories where the articles are randomly picked from and not just the category fish.
E.g. I want it to display 1 (one) random article from one of the following categories: fish, chips and potatoes.
How can I achieve this? I already tried searching the forum, but without succes. And I also tried some things myself, but I lack the knowledge to do this properly.
So can anyone help me out here?
Thanks a million!
- The topic ‘How do I display 1 random article from multiple categories?’ is closed to new replies.