Easily embed White House petitions from We The People into your WordPress site via shortcodes and widgets.
The plugin includes a number of different ways to embed petitions from We The People:
The simplest way to get started is through WordPress shortcodes. The syntax is as easy as:
Petitions IDs aren't especially easy to uncover from the We The People site so the We The People plugin includes a TinyMCE button to help you. Clicking the button will open an overlay that will let you search the We The People petitions by title to find your issue. You may also limit your search results to open petitions.
To add a We The People petition to a WordPress dynamic sidebar go to Appearance > Widgets and drag a "WTP Petition" widget into the desired sidebar. Like the TinyMCE button the widget allows you to search for your desired petition by title and show only open petitions.
If you're a developer and need more complete access to the We The People API you can use the
api() method available through the
$GLOBALS['we-the-people'] global variable. The
api() method accepts two arguments: the API method to call ('retrieve' or 'index' in version 1.*) and an array of arguments to pass to the API.
Note: Before version 2.0, the plugin used a global
$we_the_people variable. If you did customizations to We The People templates you'll want to be sure to update this reference.
We The People has a built-in petition template but makes it easy to override in your theme. It may be easiest to copy templates/wtp-petition.php into your theme to get started but a very basic custom template might look something like this:
<div id="wtp-petition-<?php echo $petition->id; ?>" class="wtp-petition"> <h2 class="petition-title"><?php echo $petition->title; ?></h2> <p> <strong><?php printf( __( '%d signatures.', 'my-theme' ), $petition->signaturesNeeded ); ?></strong> <a href="<?php echo $petition->url; ?>" title="<?php echo esc_attr( __( 'Sign this petition on We The People', 'we-the-people' ) ); ?>" class="sign-btn" rel="external"><?php _e( 'Sign this petition' ); ?></a> </p> </div><!-- #wtp-petition-<?php echo $petition->id; ?> -->
We The People uses the following order to determine which template to use when displaying a petition:
Requires: 3.5.1 or higher
Compatible up to: 4.1.14
Last Updated: 2 years ago
Active Installs: 40+
Got something to say? Need help?