Do you want to add the official LinkedIn share button in WordPress? There are many social media plugins that allow you to add share buttons, but most of them don't use the official buttons. In this article, we will show you how to add the official LinkedIn share button in WordPress.
For this tutorial, you will need to edit your WordPress theme files. If you haven't done so before, check out our guide on how to copy and paste code in WordPress.
First, you need to visit the LinkedIn plugin page. You will be prompted to select the language of your website and the button style you wish to use.
You can leave the URL field blank because the share button can automatically get the URL of the page.
Next, you need to click the "Get Code" button to copy the LinkedIn Share button code.
Now that we have the code to share, let's add the official buttons to your WordPress site.
If you want to display the LinkedIn Share button before your post content, you can use the following code. You will need to copy and paste this code into your theme's functions.php file or a site-specific plugin.
la función wpb_linkedin_share_before ($ content) // El código compartido que copió de LinkedIn va aquí $ sharecode. = 'lang: en_US'; $ newcontent = $ sharecode. $ content; devolver $ newcontent; add_filter ('the_content', 'wpb_linkedin_share_before');
You can save your changes and visit your website to see it in action.
If you want to display the share button after your post content, you will need to add the following code instead.
función wpb_linkedin_share_after ($ content) $ sharecode. = 'lang: en_US'; $ newcontent = $ content. $ código compartido devolver $ newcontent; add_filter ('the_content', 'wpb_linkedin_share_after');
You can also add the LinkedIn Share button code you copied earlier directly into a custom WordPress HTML widget. Simply visit Appearance »Widgets page and add the 'Custom HTML' widget to a sidebar.
Next, add the LinkedIn Share button code inside the custom HTML widget and click the Save button to store your changes.
Now you can visit your website to see it in action.
We hope this article helped you learn how to easily add the official LinkedIn share button in WordPress. You may also want to see our list of the best LinkedIn plugins for WordPress.
If you enjoyed this article, please subscribe to our WordPress YouTube Channel video tutorials. You can also find us on Twitter and Facebook.