• Resolved frakality

    (@frakality)


    Hello
    ì would like to display total vote for each polls I’ve created outside the related polls page.

    I am loading a poll into a post item, then all posts are listed on a page as a basic blog page

    I used this snippet to display total votes :

    <?php if ( function_exists( 'get_pollvotes' ) ): ?> <?php get_pollvotes(); ?> <?php endif; ?>

    but it seems that it’s displaying total votes for all polls, not only the related poll.

    How can I do to get the XX votes for a related poll ?

    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Lester Chan

    (@gamerz)

    
    $poll_id = 123;
    echo $wpdb->get_var( $wpdb->prepare( "SELECT pollq_totalvoters FROM $wpdb->pollsq WHERE pollq_id = %d LIMIT 1", $poll_id ) );

    Where 123 is your poll_id.

    Thread Starter frakality

    (@frakality)

    Thanks for your reply, perfect

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display total votes outside poll template’ is closed to new replies.