Jump to content
Sign in to follow this  
galsterer

Problem with hook

Recommended Posts

galsterer

Hi, I tried the following hook to add a +1 plugin to the sharebare. add_action('pagelines_after_sharebar', 'add_googleplus_icon'); function add_googleplus_icon(){ google_plus_one(); } The hook works, but now the +1 button is shown two times?? Any idea whats wrong with it? Example: http://galsterer.net/wordpress/2011/06/26/culinarium_bavaricum/

Share this post


Link to post
Share on other sites
catrina

Hm, how is that button added? Is there a plugin and is that shortcode in the hook the one you add?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
galsterer

Yes, exactly. I use a plugin and that code in the funktions.php of the child theme. Before I tried the original code from google, but the result was the same. I always get this two buttons.

Share this post


Link to post
Share on other sites
catrina

Hm, do you want to test it on another theme (the default Twenty Ten)? If you install the plugin there and place short code (or original code from Google), we can see if the problem is the button or the theme.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
galsterer

btw The plugin is the "Google Plus One Button" and can be included by this manually:

 <?php if (function_exists('google_plus_one')) { google_plus_one(); } ?> 

Share this post


Link to post
Share on other sites
kference

I was going to create a new thread but before creating it I decided to do a quick search and it turns out I'm not the only one having this issue. When using the 'pagelines_after_sharebar' hook the output is indeed duplicated. The first output is put inside the share bar as you would expect based on the code in section.sharebar.php. In that file the hook is registered immediately after the share_digg icon code and before the closing DIV tag for the DIV class="right" container. However, the same output is also inserted immediately after the closing DIV tag for the share bar container. This is very easy to test using the following non intrusive code: function my_test(){echo '';} add_action('pagelines_after_sharebar', 'my_test'); Is this intentional and if not is it a known issue? EDIT: Interestingly enough this also happens with the 'pagelines_before_sharebar' hook. :(

Share this post


Link to post
Share on other sites
Simon
	add_action( 'wp_head', create_function('','echo "";'));
	add_filter( 'pagelines_before_sharebar', create_function('', 'return "";'));
	[/code]

Share this post


Link to post
Share on other sites
makeylon

Any answer on this? It does duplicate the button (or anything), before or after the sharebar as well as putting it inside the sharebar. I haven't been able to find an answer for this yet.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×