I have a site which on some pages will have 2 +1 icons, 1 at the top which is a +1 for the root of the site and the second is the +1 which is pointing to the article, and both +1's pointing to the current page.

I am directly calling the theme function like so.

echo theme('google_plusone_button', array('size' => 'small', 'count' => 1, 'url' => url('<front>', array('absolute' => 1))));

and

echo theme('google_plusone_button', array('size' => 'medium', 'node' => $node));

and the returned google html seems to be correct. but the buttons seem to point to the url of the node.

Comments

agoradesign’s picture

Hi,
I'm quite sure that is related to this bug report: http://drupal.org/node/1206098

Currently there exists a bug when choosing the HTML5 method because a wrong HTML5 attribute is generated ('href' instead of 'data-href').

You have two possibilites:

  1. choose the proprietary g:plusone tag instead of HTML5: simply add 'syntax' => 'g:plusone' to your arguments array
  2. modify the code by yourself and open the google_plusone.module file and prefix the 'href' attribute. Therefore you have to scroll to line 134 and change the next few lines like this:
      // Rendering HTML.
      $syntax = $variables['syntax'];
      $data = $syntax === 'g:plusone' ? '' : 'data-';  // HTML5 valid attributes must have 'data-' prefix
      $url = $data . 'href="' . $url . '" ';
      $size =  empty($variables['size'])  ? '' : $data . 'size="' .  check_plain($variables['size']) . '" ';
      $count = empty($variables['count']) ? '' : $data . 'count="false" ';
    
corbacho’s picture

Status: Active » Fixed

Or third possibility:
Download the 6.x-1.0-rc8 version
Thanks for reporting

gordon’s picture

Thanks that fixed it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.