WordPress.org

Ready to get started?Download WordPress

Plugin Directory

We The People

Easily embed White House petitions from We The People into your WordPress site via shortcodes and widgets.

How can I change the templates used to display petitions?

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:

Shortcodes:

  1. wtp-petition-{id}.php (child theme)
  2. wtp-petition.php (child theme)
  3. wtp-petition-{id}.php (parent theme)
  4. wtp-petition.php (parent theme)
  5. templates/wtp-petition.php (plugin)

Widgets:

  1. wtp-petition-widget-{id}.php (child theme)
  2. wtp-petition-widget.php (child theme)
  3. wtp-petition-widget-{id}.php (parent theme)
  4. wtp-petition-widget.php (parent theme)
  5. templates/wtp-petition-widget.php (plugin)

You can find more information regarding template customization (including action hooks and filters) on the plugin's Github page.

How do I prevent We The People from loading the bundled scripts and styles?

The We The People stylesheet and JavaScript file are enqueued in typical WordPress fashion when the plugin is loaded on WordPress init. Dropping this function in your WordPress theme should prevent the default We The People assets from loading:

/**
 * Prevent We The People from loading scripts and styles
 * @uses wp_dequeue_script()
 * @uses wp_dequeue_style()
 */
function mytheme_disable_wtp_scripts_styles() {
  wp_dequeue_script( 'we-the-people' );
  wp_dequeue_style( 'we-the-people' );
}
add_action( 'init', 'mytheme_disable_wtp_scripts_styles' );

Can visitors sign a petition using the plugin?

At this time the We The People API is read-only, meaning your readers would need to visit https://petitions.whitehouse.gov in order to sign a petition. The White House plans to release a write API sometime in the near future at which point this plugin will be upgraded to enable this capability.

Requires: 3.5.1 or higher
Compatible up to: 3.6.1
Last Updated: 2013-10-5
Downloads: 306

Ratings

0 stars
0 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1