Nice one, Matt. This adds so much functionality and value to the plugin, in my opinion. I’m sure I’ll be adding a link to my blog using the random_cat_id parameter.
if you edit the random-redirect.php file and insert
gthi code
if ( isset( $_GET[‘random_post_day’] ) ) {
$post_type = preg_replace( ‘|[^1-9]|i’, ”, $_GET[‘random_post_day’] );
$query = “SELECT ID FROM $wpdb->posts WHERE post_date like ‘%$post_type%’ AND post_password = ” AND post_status = ‘publish’ ORDER BY RA
ND() LIMIT 1″;
}
right before
Nice one, Matt. This adds so much functionality and value to the plugin, in my opinion. I’m sure I’ll be adding a link to my blog using the random_cat_id parameter.
Thanks for the update. ๐
Awesome! I have this on my photo blog. I edited it so that it would use “/random/” as well. Great plugin—thanks for sharing.
Hopefully Blicki will be available soon… ๐
I am at a total loss… how do I use one of the other parameters?
I have tried http://www.hotforwords.com/?random_cat_id=3
…/?random&random_cat_id=3
…/?random_post_type=lessons
and so many other options.. but don’t know how to make them work. Can you please show me?
Thanks!
Marina
Hello, Matt.
How can I use the random_cat_id parameter? I’d love an example.
Thanks!
For those that need help with it:
For posts in a particular category: http://somedomain.com/?random=1&random_cat_id=3
For specific post types:
http://somedomain.com/?random=1&random_post_type=%type
Where %type is either attachment, post, or page.
Here is how you do it:
?random&random_cat_id=3 or ?random&random_post_type=post
Thanks JD @ jdh23.com !!
if you edit the random-redirect.php file and insert
gthi code
if ( isset( $_GET[‘random_post_day’] ) ) {
$post_type = preg_replace( ‘|[^1-9]|i’, ”, $_GET[‘random_post_day’] );
$query = “SELECT ID FROM $wpdb->posts WHERE post_date like ‘%$post_type%’ AND post_password = ” AND post_status = ‘publish’ ORDER BY RA
ND() LIMIT 1″;
}
right before
$random_id = $wpdb->get_var( $query );
you may user
http://somesite.com/?random&random_post_day=2008-09-12
and you have a random post of the day
If you have to many posts per day ๐