Can I display the total signatures of 2 petitions?

Yes, but it isn’t quite so straightforward.

Note that in the Pro Version there is a shortcode ( [signaturestotal hideunconfirmed="true"] ) to display the total signatures of all petitions.

Firstly install the plugin: Insert PHP Code Snippet.  This allows us to add PHP code to the page.

Go into the XYZ PHP Code > Settings and disable Autoinsert PHP opening tags

Then go back to XYZ PHP Code > PHP Code Snippets and Add new PHP code snippet

Before you add the code, notice the arrows, the number in each case has to match the petition number.

Tracking name: multisignatures

PHP Code:

// IF YOU ARE USING THIS ON A PAGE WITHOUT A PETITION  you need to include the petition class by removing the // from in front of the next line
//include_once( 'wp-content/plugins/speakout/includes/class.petition.php' );
// create a new petition object
$petition = new dk_speakout_Petition();

   // check if first petition exists
   $petition1_exists = $petition->retrieve( 1 );
    // if it does
    if ( $petition1_exists ) {
       // get the signature count and save it in $signature_total
       $signature_total = $petition->signatures;
    }

   // see if our next petition exists
   $petition7_exists = $petition->retrieve( 7 );
   if ( $petition7_exists ) {
       // this time add our signature count to $signature_total - we have a running total
       $signature_total = $signature_total + $petition->signatures;
 }

// you could repeat the second block to add a 3rd or more petitions

// print the signature total on the page
echo $signature_total;

Awesome!  We now have the total signatures of petitions 1 & 7 sitting in a variable ready to be displayed on the page.

Next we need to add the shortcode to the page to actually display it.

Total signatures - [xyz-ips snippet="multisignatures"]

Here is live data – The total of two SpeakOut! demo petition signatures is 443 – note that this is actually petitions 1 & 8, I didn’t want to have to do the screenshots again 😛