WordPress Plugins > WP-Polls
Tips & Tricks For WP-Polls
Ttech:
This is the page to find all the tips and tricks for WP-Polls. ;)
How to display more than one poll in sidebar? by eleight
You can use this little dirty hack ;) It will output $limit active polls. You can easily extend this function to suit your needs!
--- Code: ---function get_active_polls($limit) {
global $wpdb;
$rez = $wpdb->get_results("SELECT pollq_id FROM $wpdb->pollsq WHERE pollq_active = 1 ORDER BY pollq_id DESC LIMIT ".$limit);
foreach($rez as $poll) {
get_poll($poll->pollq_id);
}
}
--- End code ---
and then in sidebar replace
--- Code: ---get_poll();
--- End code ---
with
--- Code: ---get_active_polls();
--- End code ---
Note: If you are using widgets, there is already support for multiple polls. Under "WP-Admin -> Presentation -> Widgets -> Polls". Configure Poll Widget by clicking on the square icon besides the Widget Title, under "Current Active Poll", choose "Display Multiple Polls".
JonB:
Thanks for this. Was just about to come and post a question regarding your first tip! ;D
Ttech:
No problem. ;)
waterbender:
It's not letting me display polls outside of wordpress... Help?
I have all the right stuff in the head section, and the php get poll code where I want it, but all I get is errors.
Ttech:
Page? Site? Errors? Anything?
Navigation
[0] Message Index
[#] Next page
Go to full version