Rss Feed
Tweeter button
Facebook button
Flickr button
Jul 28, 2011

Posted in Daily Post, Web Design | 2 comments

How to setup addthis to share the post rather than the page in wordpress

How to setup addthis to share the post rather than the page in wordpress

Today I would like to share a quick tip for manually adding the addthis social sharing plugin to your wordpress site, and more importantly, to set it up, so that it shares and counts the specific individual post that its placed on in blog view, rather than sharing the page as a whole.

You may have come accross this issue, when you added the addthis plugin to your posts, it works perfectly on the article page, but on your homepage or category pages, where you have multiple posts, it shares the page instead of the article.

Okay, so lets start by grabbing the original code from addthis.com :

1
2
3
4
5
6
7
8
9
 <!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a></div>
<script src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4e31b01b1e3abce0" type="text/javascript"></script>

What we want to do now, is to ammend the first line slightly so that it gets the link to the actual post and shares that instead of the page as a whole.  This will still work on article view, so you can just use this code throughout your site.

1
<div class="addthis_toolbox addthis_default_style"addthis:url="<?php the_permalink() ?>">

So by ammending the first line and giving it instructions to the url we are interested in, addthis will now link to the permalink of your post. So your addthis code should now look something like this:

1
2
3
4
5
6
7
8
9
10
11
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style"addthis:url="<?php the_permalink() ?>">
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4e31b01b1e3abce0"></script>
<!-- AddThis Button END -->

 

      

Related posts:

  1. How to link addthis plugin to a joomla article in category blog view rather than the blog page itself
  2. How to get first page google ranking in less than 2 months
  3. How to convert your current installation of english wordpress to arabic
  4. Contact Me
  5. How to use custom arabic fonts in your web design projects
988 views
  • Someonewho

    Thank you for the great trick! I had it already working, but now it’s gone. Is it possibly not compatible with WordPress 3.3.1?

  • Anonymous

    Hi there, i just upgraded to 3.3.1 and it is still working .. are you using a plugin or manually adding addthis to your site?