Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 03-07-2014, 09:50 AM   #1
eroticfem
Confirmed User
 
Join Date: Sep 2009
Location: Europe
Posts: 362
WP plugin code help!

I found this randomize plugin and it works great, but the problem is that it has an issue with the pages. When active it random the posts but when i click on a new page it does not move from page 1 to 2 etc. Anyone know how to fix that in this code?

Code:
if(!get_option("post_randomize")) update_option("post_randomize","true");

function post_randomizer () {
	if (get_option("post_randomize")=="true") {
		if (is_home() || is_feed()) query_posts("orderby=rand");
	}
}
function postrandomizer_widget_initial () {
	wp_add_dashboard_widget("Post Randomizer","Post Randomizer","postrandomizer_widget");
}
function postrandomizer_widget() {
	global $wpdb;
	if ($_POST["postrandom"]<>"") {update_option("post_randomize","true");echo "<div class='updated fade'>Setting saved</div>";}
	if ($_POST["postunrandom"]<>"") {update_option("post_randomize","false");echo "<div class='updated fade'>Setting saved</div>";}
	$stat = get_option("post_randomize");
	if ($stat=="true") $current="Randomized";
	else $current = "Normal Order";
	echo "Current Status: <div align='center'><h1>$current</h1> Randomize the displayed post on your homepage and on the feed. It will be useful for site or blog that not daily updated so when the visitor come stopping by on your homepage, he won't see same posts or contents twice. <a href='http://mr.hokya.com/post-randomizer/' target='_blank'>See more</a>";
	echo "<p><form method='post'><input name='postrandom' type='submit' value='Randomize' class='button-primary'/><input name='postunrandom' type='submit' value='Do not Randomize' class='button-primary'/></form></p></div>";
}

add_action('wp_dashboard_setup', 'postrandomizer_widget_initial');
add_action('get_header', 'post_randomizer');
add_action('atom_head', 'post_randomizer');
add_action('rss_head', 'post_randomizer');
add_action('rss2_head', 'post_randomizer');

?>
__________________
eroticfem is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-07-2014, 09:57 AM   #2
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Quote:
Originally Posted by eroticfem View Post
I found this randomize plugin and it works great, but the problem is that it has an issue with the pages. When active it random the posts but when i click on a new page it does not move from page 1 to 2 etc. Anyone know how to fix that in this code?

Code:
if(!get_option("post_randomize")) update_option("post_randomize","true");

function post_randomizer () {
	if (get_option("post_randomize")=="true") {
		if (is_home() || is_feed()) query_posts("orderby=rand");
	}
}
function postrandomizer_widget_initial () {
	wp_add_dashboard_widget("Post Randomizer","Post Randomizer","postrandomizer_widget");
}
function postrandomizer_widget() {
	global $wpdb;
	if ($_POST["postrandom"]<>"") {update_option("post_randomize","true");echo "<div class='updated fade'>Setting saved</div>";}
	if ($_POST["postunrandom"]<>"") {update_option("post_randomize","false");echo "<div class='updated fade'>Setting saved</div>";}
	$stat = get_option("post_randomize");
	if ($stat=="true") $current="Randomized";
	else $current = "Normal Order";
	echo "Current Status: <div align='center'><h1>$current</h1> Randomize the displayed post on your homepage and on the feed. It will be useful for site or blog that not daily updated so when the visitor come stopping by on your homepage, he won't see same posts or contents twice. <a href='http://mr.hokya.com/post-randomizer/' target='_blank'>See more</a>";
	echo "<p><form method='post'><input name='postrandom' type='submit' value='Randomize' class='button-primary'/><input name='postunrandom' type='submit' value='Do not Randomize' class='button-primary'/></form></p></div>";
}

add_action('wp_dashboard_setup', 'postrandomizer_widget_initial');
add_action('get_header', 'post_randomizer');
add_action('atom_head', 'post_randomizer');
add_action('rss_head', 'post_randomizer');
add_action('rss2_head', 'post_randomizer');

?>
are you just trying to show a random post via dashboard?

using query_posts is a bit outdated for this, what is the exact scope you are trying to do, cause this will do nothing for people actually visiting the site.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-07-2014, 10:13 AM   #3
eroticfem
Confirmed User
 
Join Date: Sep 2009
Location: Europe
Posts: 362
I was testing out plugins that would hopefully randomize x- posts from each categories once a day or on each reload. And this is no longer being updated thats why i posted it here, maybe it would be possible to get it working ...
__________________
eroticfem is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 03-07-2014, 11:50 AM   #4
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Quote:
Originally Posted by eroticfem View Post
I was testing out plugins that would hopefully randomize x- posts from each categories once a day or on each reload. And this is no longer being updated thats why i posted it here, maybe it would be possible to get it working ...
you can run a filter on your posts so it loads them on random each load, let me know the full scope you want, every bit of info so i can code up and give it to you.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.