On Wordpress archive and homepage - how to take title from individual posts?

dberg369 Jul 09, 2012 07:49PM EDT

Hi there,

On Wordpress archive and homepages which contain a number of posts excepts, the following addthis code works perfectly when I want the buttons to share the permalink of a particular post instead of the archive page.

[code]
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a addthis:url="<?php the_permalink() ?>" class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a addthis:url="<?php the_permalink() ?>" class="addthis_button_tweet"></a>
<a addthis:url="<?php the_permalink() ?>" class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript" src="xxxxxxxxxxxxxxxxxxxxxxxxxxx"></script>
<!-- AddThis Button END -->
[/code]

However, it doesn't bring in the title of the linked post, instead it uses the archive page's title.
Is there a way to change this?

Many thanks,
Dan

Up 0 Rated Down
Paul (AddThis Happiness Specialist) Jul 10, 2012 04:49PM EDT
You need to add the title attribtue to the toolbox, like this:

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style " addthis:url="<?php the_permalink();?>" addthis:title="<?php the_title(); ?>">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript" src="xxxxxxxxxxxxxxxxxxxxxxxxxxx"></script>
<!-- AddThis Button END -->

Note that Facebook doesn't work like the other AddThis buttons. Instead of accepting parameters that we pass it, Facebook requests the URL you're sharing and gets the data it displays from the meta and link tags in the header. To control how your page is shared on Facebook you should use OpenGraph tags which are described in Facebook's documentation here: http://developers.facebook.com/docs/opengraph/

This question is closed to new answers.

Still need help?


General Topics

 

Developers