Jump to content
Sign in to follow this  
perrknight

Adding LinkedIn share button to share bar

Recommended Posts

perrknight

I am having trouble adding the LinkedIn share button from https://developer.linkedin.com/plugins/share-button?button-type-nocount=true to the sharebar in the PageLines Framework theme. This is for the site www.JIOps.com. I managed to add the Google +1 button by adding the following code to functions.php and the proper css to the custom code section:

add_action( 'wp_head', create_function('','echo "";'));
			add_filter( 'pagelines_before_sharebar', create_function('', 'return "";'));[/code]

	
	I can't get this to work though for the LinkedIn share button, and hope that someone can provide some advice. LinkedIn indicates that I should add the following code to my site:
	
	
[code]

Any feedback will be greatly appreciated.

Share this post


Link to post
Share on other sites
kastelic
Dopes the script have to go in the head, or should both scripts go where you want the button to appear? Try this: [code] add_action('pagelines_before_sharebar','linked'); function linked(){ ?>

Share this post


Link to post
Share on other sites
perrknight
Thanks for getting back to me. This method moves me closer, but is not resolving the problem entirely. If I add another "pagelines_before_sharebar" hook for the LinkedIn button, the original google +1 icon disappears. If I change this to "pagelines_after_sharebar", it seems to work except that there are two instances of the linkedin share button: 1 at the end of the sharebar, and 1 above the sharebar. So continuing with this method, I would need to further: 1. remove the instance of the LinkedIn button that is floating below the sharebar, left-aligned 2. Figure out how to place the LinkedIn share button as the first or second icon in the sharebare without disturbing the Google+1 icon

Share this post


Link to post
Share on other sites
catrina
[quote]1. remove the instance of the LinkedIn button that is floating below the sharebar, left-aligned[/quote] It might be possible to hide this with CSS but I'm not 100% certain.

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
perrknight
Both instances of the button use the same CSS, so I cannot hide one without the other. I've actually tried using similar code for the LinkedIn button as I used for the Google+ button, but the LinkedIn button still is not showing up. Any idea why this isn't working given the following iteration of the code? [code]add_action( 'wp_head', create_function('','echo "";')); add_filter( 'pagelines_after_sharebar', create_function('', 'return "";'));[/code]

Share this post


Link to post
Share on other sites
Jenny
Suggestion/idea: If you're using the Google+ sharebar add-on from the store (which it sounds like), just deactivate it and then use its code to combine it with yours for linked in.

Jenny :: Web designer at Simple Mama (follow me at @simplemamacom)

Check out Share Me, a social sharing add-on for DMS that is super simple to set up.

Share this post


Link to post
Share on other sites
perrknight
I'm not actually using a Google+ sharebar add-on from the store. Just the code stated above.

Share this post


Link to post
Share on other sites
Jenny
hmm.. seems you need to get both functions going on at once. Go ahead and try this but don't yell at me if it breaks your site. ;) [code]add_action( 'wp_head', create_function('','echo "";','echo "";')); add_filter( 'pagelines_after_sharebar', create_function('', 'return "";', 'return "";'));[/code]

Jenny :: Web designer at Simple Mama (follow me at @simplemamacom)

Check out Share Me, a social sharing add-on for DMS that is super simple to set up.

Share this post


Link to post
Share on other sites
perrknight
Thanks, Jenny. I tried that previously, as well as your version of the similar code, and neither worked. Any idea if PageLines might add these share functions as part of the standard functionality at some point?

Share this post


Link to post
Share on other sites
kastelic
I've never done it with a create_function() for the second parameter so I can't be of much help there. But can't you combine the two icons in one function? [code] add_action('pagelines_before_sharebar_','custom_icons'); function custom_icons(){ //G+ code goes here //Linkedin code goes here } [/code]

Share this post


Link to post
Share on other sites
perrknight
Thanks again. I tried that method, and it crashed my site.

Share this post


Link to post
Share on other sites
perrknight
Hi Catrina, I was able to remove the code, thanks. What is the best means of requesting new features for PageLines? For instance, adding the Google+ and LinkedIn share functions to the standard share bar.

Share this post


Link to post
Share on other sites
Jenny
I'm working on a custom sharebar section. Feel free to PM me the code and I will try to add it. Otherwise, you could always download/activate the google+ addon from the pagelines store, and then duplicate that file, changing to linkedin as needed, put it in a folder, zip, and upload in the Plugins menu. :)

Jenny :: Web designer at Simple Mama (follow me at @simplemamacom)

Check out Share Me, a social sharing add-on for DMS that is super simple to set up.

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  

×