WordPress Plugins > WP-Polls
Display Current Poll w/ Previous Polls Results Below it
(1/1)
capsrock:
I've been searching this forum and all the wp_poll documentation I can find for a way to have my current poll showing and right below it have the results from the poll that was previously active. I can do this by hard coding it but I want it to update automatically. For example, if the current polls id is 3, i want to be able to show the results for poll id 2 underneath of it. I thought there would be a way that I could do something like this:
$current_poll = get_poll(poll id);
$previous_poll = $current_poll - 1;
From what I've read, there is no way to return just the poll id number. Is there another way to do this? Here is the code I'm currently using:
if (function_exists('vote_poll') && !in_pollarchive()):
get_poll();
endif;
$id = 2;
echo("<hr width=95% align=center noshade color=#333>");
echo do_shortcode('[poll id="' . $id . '" type="result"]');
I want to be able to replace the "$id = 2;" part with a dynamically generated id number for the previous poll. Thanks to any one who is able to offer up some help.
capsrock:
For anyone who may be interested, I found all the code I needed here:
http://www.phpkode.com/source/s/wp-polls/wp-polls/wp-polls.php
The line to return the current poll id is:
$poll_id = intval(get_option('poll_latestpoll')) - 1;
Note: I added '- 1' in order to obtain the id of the previous code. It works like a champ.
Navigation
[0] Message Index
Go to full version