share button only working for google+ and facebook

contacto Jul 24, 2012 11:04PM EDT

Hi!

Im trying hard to fix one problem Im having on my site.
To a better understanding, my site is this:
http://www.hogardelocio.com/

As you can see it have a lot of posts to different links in one single page, I need it when a user click on share it share the permanent link of that post, witch is http://www.hogardelocio.com/pl.php?pl= (post id).

The code Im using is this:

<div class="addthis_toolbox addthis_default_style" align="center" addthis:url="http://hogardelocio.com/pl.php?pl=<?php echo $lid_0;?>" addthis_title="<?php echo $titulo_0 ;?>">
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_google_plusone_share"></a>
<a class="addthis_button_stumbleupon"></a>
<a class="addthis_button_compact"></a>
<!--<a class="addthis_counter addthis_bubble_style"></a>-->
</div>
<script type="text/javascript">var addthis_share = {url:"<?php echo "http://www.hogardelocio.com/pl.php?pl=$lid_0" ?>"};</script>
<script type="text/javascript">var addthis_share = {title: "<?php echo $titulo_0 ;?>"}</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-500b206262a090d2"></script>

and it increase the number for every post, for example for the next button on the same page is "$lid_1". The problem is that on facebook and google+, it works perfect with the correct image, title and link, but on the stumbleupon it goes with the wrong title but the right link, and on twitter it goes with wrong title and the link it generate just dont open any page.

Obs: To make it work on facebook and google+, I had to put this meta codes on my /pl.php:
<meta property="og:title" content="<?php echo $titulo; ?>" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://hogardelocio.com/pl.php?pl=<?php echo $lid; ?>" />
<meta property="og:image" content="http://hogardelocio.com/img/<?php echo $imagem; ?>" />
<meta property="og:site_name" content="Hogar del Ocio" />

can someone please help me?
thanks

Up 0 Rated Down
Paul (AddThis Happiness Specialist) Jul 27, 2012 11:06AM EDT
There are two problems. First, you're setting the URL twice, which you don't need to do. Second, you're overriding the URL setting by declaring the addthis_share variable twice. Change your code to this:

<div class="addthis_toolbox addthis_default_style" align="center" addthis:url="http://hogardelocio.com/pl.php?pl=<?php echo $lid_0;?>" addthis_title="<?php echo $titulo_0 ;?>">
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_google_plusone_share"></a>
<a class="addthis_button_stumbleupon"></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=ra-500b206262a090d2"></script>

Also, if you've got more than one toolbox on the page you don't need the JavaScript every time.
Up 0 Rated Down
hogardelocio Aug 02, 2012 01:32PM EDT
I found the problem! it was here :

addthis_title = not working / addthis:title = working perfect :)

This question is closed to new answers.

Still need help?


General Topics

 

Developers