Posted by Filip P259curar on Fri 19 Jun 17:20
report abuse | download | new post
- <?php
- /**
- * Template Name: Aleator
- */
- $query = "SELECT ID, object_id, term_taxonomy_id FROM $wpdb->posts as p, $wpdb->term_relationships AS t WHERE p.post_status = 'publish' && (p.ID = t.object_id) ORDER BY RAND() LIMIT 0,1";
- $test_id = $wpdb->get_var($query);
- query_posts('p='.$test_id);
- if (have_posts()) : while (have_posts()) : the_post();
- wp_redirect(get_permalink());
- endwhile; endif;
- ?>
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.