Title: [Plugin: WordPress Google  1 Button &#8211; Advanced Plugin, Includes Redirection] php code to insert into
Last modified: August 20, 2016

---

# [Plugin: WordPress Google 1 Button – Advanced Plugin, Includes Redirection] php code to insert into

 *  Resolved [elementel](https://wordpress.org/support/users/elementel/)
 * (@elementel)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-google-1-button-advanced-plugin-includes-redirection-php-code-to-insert-into-template/)
 * I’d like to have even more control of where this code appears on my client’s 
   site. Shortcode is great but that would require my client to always put the shortcode
   in at the beginning of every post.
 * What is the code I would use to insert this into the single.php file?
 * In other words, is there something like a “if function exists” kind of code I
   can copy and paste in place? I have done this with a number of plugins like pixopoint
   menus etc.
 * Any help at all would be greatly appreciated!
 * [http://wordpress.org/extend/plugins/wp-plus-one/](http://wordpress.org/extend/plugins/wp-plus-one/)

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

 *  Plugin Author [Jacob Gillespie](https://wordpress.org/support/users/jacobwg/)
 * (@jacobwg)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-google-1-button-advanced-plugin-includes-redirection-php-code-to-insert-into-template/#post-2387163)
 * I actually don’t have shortcode support added yet, so it’s good you need the 
   PHP version. 🙂
 * The code you need is:
 *     ```
       <?php do_action( 'wp_plus_one_button', $url, $style, $css, $count, $redirect); ?>
       ```
   
 * You don’t need any if function exists stuff since this is a WordPress action.
   The $url param is self-explanatory. The rest are as follows:
    - $style – button style (standard / small / medium / tall)
    - $css – custom css
    - $count – show the +1 count (true/false)
    - $redirect – a url to redirect to if the user clicks the +1 button
 * These docs are on the plugin settings page as well.
 * Let me know if that answers your question.
 * Thanks!
 *  Thread Starter [elementel](https://wordpress.org/support/users/elementel/)
 * (@elementel)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-google-1-button-advanced-plugin-includes-redirection-php-code-to-insert-into-template/#post-2387195)
 * so just to be sure, so I understand the $style etc. Can you make an example of
   that code with the $count set to true so I can see what the syntax looks like?
 * thanks so much!
 *  Plugin Author [Jacob Gillespie](https://wordpress.org/support/users/jacobwg/)
 * (@jacobwg)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-google-1-button-advanced-plugin-includes-redirection-php-code-to-insert-into-template/#post-2387200)
 * For example
 *     ```
       <?php do_action( 'wp_plus_one_button', 'http://google.com', 'tall', 'padding:10px;border: 1px solid black;'); ?>
       ```
   
 * $count by default is true
    $redirect by default is blank
 *  Thread Starter [elementel](https://wordpress.org/support/users/elementel/)
 * (@elementel)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-google-1-button-advanced-plugin-includes-redirection-php-code-to-insert-into-template/#post-2387202)
 * Jacob, you’re a gentleman and a scholar. Do you have a donate link? I believe
   in paying forward.
 *  Thread Starter [elementel](https://wordpress.org/support/users/elementel/)
 * (@elementel)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-google-1-button-advanced-plugin-includes-redirection-php-code-to-insert-into-template/#post-2387208)
 * well hold the phone. I added your example to the single.php file and it’s not
   appearing.
 * [link here](http://lauramakfitnessblog.com/hearty-chicken-soup-plus/)
 * I’m trying to force the +1 button to sit above the facebook like button because
   when people I know “like” the page, their avatars block the google +1 button 
   if it’s sitting below the facebook like.
 * So I added your sample code just right after the date code and before the content
   code. Nothing appears.
 *  Plugin Author [Jacob Gillespie](https://wordpress.org/support/users/jacobwg/)
 * (@jacobwg)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-google-1-button-advanced-plugin-includes-redirection-php-code-to-insert-into-template/#post-2387209)
 * Can you post the contents of the single.php file to pastebin.com?
 * Thanks!
 *  Thread Starter [elementel](https://wordpress.org/support/users/elementel/)
 * (@elementel)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-google-1-button-advanced-plugin-includes-redirection-php-code-to-insert-into-template/#post-2387210)
 * [here you go](http://pastebin.com/cvrcXN0X)
 *  Plugin Author [Jacob Gillespie](https://wordpress.org/support/users/jacobwg/)
 * (@jacobwg)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-google-1-button-advanced-plugin-includes-redirection-php-code-to-insert-into-template/#post-2387216)
 * That’s really strange – it should be displaying…
 * I’ll do some more digging, and if you want to email temporary admin account information
   to [me@jacobwg.com](https://wordpress.org/support/topic/plugin-wordpress-google-1-button-advanced-plugin-includes-redirection-php-code-to-insert-into-template/me@jacobwg.com?output_format=md),
   I’d be happy to take a look. It looks like the theme you are using is a premium
   iThemes theme, so I am not able to easily test the theme code locally.
 *  Plugin Author [Jacob Gillespie](https://wordpress.org/support/users/jacobwg/)
 * (@jacobwg)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-google-1-button-advanced-plugin-includes-redirection-php-code-to-insert-into-template/#post-2387217)
 * For those of you other than elementel reading this thread, we communicated via
   email and discovered that he was in fact running a different +1 button plugin
   and once we switched to this one, the PHP action code worked.

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

The topic ‘[Plugin: WordPress Google 1 Button – Advanced Plugin, Includes Redirection]
php code to insert into’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-plus-one.svg)
 * [WordPress Google +1 Button - Advanced Plugin, Includes Redirection](https://wordpress.org/plugins/wp-plus-one/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-plus-one/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-plus-one/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-plus-one/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-plus-one/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-plus-one/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Jacob Gillespie](https://wordpress.org/support/users/jacobwg/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/plugin-wordpress-google-1-button-advanced-plugin-includes-redirection-php-code-to-insert-into-template/#post-2387217)
 * Status: resolved