Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter increatives

    (@increatives)

    Any feedback on this question? Please?

    Hi, I had the same question today. After some research I found a way to get the number of total votes. You can use this code in your theme where you need it:

    <?php
      $user_count = $wpdb->get_var( "SELECT COUNT(*) FROM
      wp_dk_speakout_signatures WHERE petitions_id = 1" );
      echo "<p>Signatures: {$user_count}</p>";
     ?>

    petition_id is the the id you also use in your shortcodes to embed the signature-form or signature-list. You can delete the part “WHERE petitions_id = 1” when you just have one petition or want to count all signatures for all petitions.

    Maybe your database table for some reason has a different name. In that case you will have to adjust “wp_dk_speakout_signatures” accordingly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show number of votes?’ is closed to new replies.