AddThis is the leading developer tool for sharing your blog posts, pages, and pics. Just embed the simple code into your website, and visitors will be able to share your content with all of the leading social media networks with just a click. It’s an essential tool.
Today I will be showing you how to embed this into your WordPress site. By placing this directly into the WordPress Loop, ADDthis will now be displayed for every post that is called.
You need to do this for at least 2 pages. The index.php file and the single.php file. It is also a good idea to place it within your archive.php file as well.
Here’s how :
1. Find the WordPress loop
Open any of the following files (index.php, single.php, archive.php) and find your WordPress loop. The coding looks like this :
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
That tells WordPress to call to any post and display whatever follows until the loop is over.
2. Grab the AddThis code for your site
What you need to do is place the code AddThis provides into wherever you see fit into the post. Let’s hop over to AddThis and get the code.
Follow that URL and hit ‘Get AddThis.’ Copy the code it provides for whatever look you select.
3. Place the code within the Loop
Place that code within your Loop now wherever you wish. You will probably need to style it somehow once all is said and done, but it should look something like this :
What this is saying is basically : While you have a WordPress Loop, display the title, and then below it, display the AddThis tool.
Now this works good and well except for one thing. Your AddThis tool will grab the URL from the current page and attempt to share it.
What if you have a index.php page that displays multiple posts on one page? How will a visitor share just one post on that page? WE NEED TO FIX THAT!!
4. Add a Permalink URL to the AddThis script
There is a simple line that you need to add to make the AddThis tool fully functional within the WordPress Loop. Find the very first line :
<div class="addthis_toolbox addthis_default_style ">
and add this :
addthis:url="<?php the_permalink() ?>"
so it appears as :
<div class="addthis_toolbox addthis_default_style " addthis:url="<?php the_permalink() ?>">
That’s it! Now, whenever AddThis is used, it calls to the Permalink of each individual post and that URL as opposed to the full page.
Get to sharing!
- add this
- add this networking
- add this share post title
- add this share post url
- add this shares wordpress
- add this shares wrong url
- add this wordpress
- developer tool for sharing
- embed add this
- permalink for add this
- permalink wordpress add this
- share for wordpress
- share permalink wordpress
- social media
- tags for add this
- wordpress add this
- wordpress loop
- wordpress permalink url for add this sharing
- wordpress url for add this