I've done some searching and I can only pick up: "display random posts from a category", but I'd like to be able to offer random categories.. How could I do this? Thanks
here is the sample. not tested yet $category_ids = array_rand(get_all_category_ids()); //get all category $args = array( 'orderby' => 'rand', 'cat' => $category_ids, 'posts_per_page' => '1', ); $query = new WP_Query( $args);//wp query //loop the query result if ( $the_query->have_posts() ) { echo '<ul>'; while ( $the_query->have_posts() ) { $the_query->the_post(); echo '<li>' . get_the_title() . '</li>'; } echo '</ul>'; } else { // no posts found } wp_reset_postdata();
its very easy - search for a plugin called "SRP" or "special recent posts". you can configure what to show on the page from which all category or random using a short code.