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!
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.
Can you post the contents of the single.php file to pastebin.com?
Thanks!
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.
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.