WordPress.org

Support

Support » Plugins and Hacks » WordPress Google +1 Button - Advanced Plugin, Includes Redirection » [Resolved] [Plugin: WordPress Google 1 Button – Advanced Plugin, Includes Redirection] php code to insert into

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

  • 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/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Jacob Gillespie

    @jacobwg

    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!

    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

    @jacobwg

    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

    Jacob, you’re a gentleman and a scholar. Do you have a donate link? I believe in paying forward.

    well hold the phone. I added your example to the single.php file and it’s not appearing.

    link here

    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

    @jacobwg

    Can you post the contents of the single.php file to pastebin.com?

    Thanks!

    Plugin Author Jacob Gillespie

    @jacobwg

    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, 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

    @jacobwg

    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 ‘[Resolved] [Plugin: WordPress Google 1 Button – Advanced Plugin, Includes Redirection] php code to insert into’ is closed to new replies.
Skip to toolbar