Title: [Plugin: SpeakUp! Email Petitions] php code?
Last modified: August 20, 2016

---

# [Plugin: SpeakUp! Email Petitions] php code?

 *  [yonisink](https://wordpress.org/support/users/yonisink/)
 * (@yonisink)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-speakup-email-petitions-php-code/)
 * Hi Kregg
    Sweet plugin! Quick Q – if we want to include it via PHP in a theme
   backend, is there anything we can do other than the <? do_shortcode() ?>??
 * [http://wordpress.org/extend/plugins/speakup-email-petitions/](http://wordpress.org/extend/plugins/speakup-email-petitions/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Kreg Wallace](https://wordpress.org/support/users/kreg/)
 * (@kreg)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-speakup-email-petitions-php-code/#post-2220300)
 * Are you wanting to display the petition form in the Admin area? The plugin is
   designed to only look for the shortcode and load the appropriate JS and CSS files
   on the public pages of a site. Not sure there’s an easy workaround for this. 
   What kind of luck are you having with the do_shortcode() method?
 *  Thread Starter [yonisink](https://wordpress.org/support/users/yonisink/)
 * (@yonisink)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-speakup-email-petitions-php-code/#post-2220309)
 * Kreg,
    No, trying to just include it to load always in a PHP rather than using
   <? the_content() ?>. Basically as an example, assume we’re loading it in a sidebar
   and just want to do something like <? load_speakup_petition() ?> in sidebar.php.
   Is that possible? Otherwise I’ll try do_shortcode, but usually calling an output
   function directly is a bit easier…
 *  Plugin Author [Kreg Wallace](https://wordpress.org/support/users/kreg/)
 * (@kreg)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-speakup-email-petitions-php-code/#post-2220320)
 * There’s no way to display the petition form outside of the post loop currently,
   but I’m hoping to add a widget for the plugin at some point.
 * If you wanted to hack at it, doing something like <?php echo dk_speakup_emailpetition_shortcode(‘
   1’); ?> would display the form for a petition with the id of ‘1’, but it wouldn’t
   load the CSS or JavaScript necessary for the form to function – and the path 
   back to the AJAX processor wouldn’t be available either.
 * You could try adding a petition into the content as intended and viewing source
   to see what CSS and JS get loaded that way and try to rig those into your sidebar
   somehow to make it functional. No guarantees that this is really possible however
   😉
 *  Thread Starter [yonisink](https://wordpress.org/support/users/yonisink/)
 * (@yonisink)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-speakup-email-petitions-php-code/#post-2220360)
 * Thanks Kreg,
    Will try it out and report back.
 *  Thread Starter [yonisink](https://wordpress.org/support/users/yonisink/)
 * (@yonisink)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-speakup-email-petitions-php-code/#post-2220537)
 * Kreg,
    I did something a bit hacky that worked;
 * 1. I directly called your shortcode function in my file, eg
 *     ```
       <? 	$petition_number = array('id' => '1');
       	dk_speakup_emailpetition_shortcode($petition_number) ?>
       ```
   
 * 2. To ensure JS/CSS, I changed line 194 to
    `$shortcode_found = true;` bypassing
   your check for the shortcode.
 * I hope you don’t mind – you write very elegant code and it would be super-easy
   to add some function called, say, dk_speakup_output that I could call that would
   flag a global var called $shortcode_found and allow you to integrate that. Thanks
   again for your great plugin!
 *  Thread Starter [yonisink](https://wordpress.org/support/users/yonisink/)
 * (@yonisink)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-speakup-email-petitions-php-code/#post-2220538)
 * Whoops, meant to say, in step 2 changed that line in `includes/public.php`
 *  Plugin Author [Kreg Wallace](https://wordpress.org/support/users/kreg/)
 * (@kreg)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-speakup-email-petitions-php-code/#post-2220541)
 * Nice work. Glad you got that to work for you. Hopefully I’ll be able to get a
   widget working for the plugin soon to relieve you of the need for the hack.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘[Plugin: SpeakUp! Email Petitions] php code?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/speakup-email-petitions_658195.svg)
 * [SpeakUp! Email Petitions](https://wordpress.org/plugins/speakup-email-petitions/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/speakup-email-petitions/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/speakup-email-petitions/)
 * [Active Topics](https://wordpress.org/support/plugin/speakup-email-petitions/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/speakup-email-petitions/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/speakup-email-petitions/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Kreg Wallace](https://wordpress.org/support/users/kreg/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/plugin-speakup-email-petitions-php-code/#post-2220541)
 * Status: not resolved