Radom Link from one category
-
Hi! I’m using this code to get one radom link from my posts:
<?php $randomPost = $wpdb->get_var("SELECT guid FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY rand() LIMIT 1"); echo '<a href="'.$randomPost.'">Radom post</a>'; ?>
Buy, what can i edit to only get posts from category 21?
Tnks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Radom Link from one category’ is closed to new replies.