We The People WordPress Plugin

National Day of Civic Hacking
June 1, 2013
@BuckeyeWebDev / @stevegrunwell

Who am I?

Goals of the plugin

  1. Make it as easy as possible for site owners to embed petitions
  2. Provide reasonable defaults but make them easy for developers to override
  3. Reduce impact on site performance

Default styles in TwentyTwelve

A We The People petition embedded in a WordPress blog post using the default TwentyTwelve theme

How the plugin works

  • [wtp-petition] shortcode
  • Sidebar widget
  • Access to the API methods via the $we_the_people global (for advanced users)

Highly themeable

WordPress-inspired template inheritance:

  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)

Performance

  • Stores API responses as short-term transients
  • Keeps long-term transients in case of API disruption
  • Ajax results cached to prevent unnecessary calls

Questions?


Steve Grunwell
Developer, Buckeye Interactive
@BuckeyeWebDev / @stevegrunwell