Keyword

[SOLVED]K2 Google+ button not working with RokBooster.

More
9 years 2 months ago - 9 years 2 months ago #140243 by Robin
Hi there, i was facing the problem that The Google Plus button (delivered with K2 2.6.9) was not working with Rockettheme's Rokbooster.
Validator.w3.org was also showing div errors.

Specs: My Joomla install (3.3.6) with the Google Plus button (K2 items 2.6.9) and Rokbooster (1.1.13).

When Rokbooster is disabled, The google Plus button is available.
When Rokbooster is disabled the button doesn't display.

Solution
I made an override file for K2 (itemp.php) - It needs to be placed in JoomlaInstallDir\templates\YourTemplate\com_k2\default
Original item.php can be found at JoomlaInstallDir\components\com_k2\templates\default

Old Code:
<?php if($this->item->params->get('itemGooglePlusOneButton',1)): ?>
		<!-- Google +1 Button -->
		<div class="itemGooglePlusOneButton">
			<g:plusone annotation="inline" width="120"></g:plusone>
			<script type="text/javascript">
			  (function() {
			  	window.___gcfg = {lang: 'en'}; // Define button default language here
			    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
			    po.src = 'https://apis.google.com/js/plusone.js';
			    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
			  })();
			</script>
		</div>
		<?php endif; ?>

New Code:
<?php if($this->item->params->get('itemGooglePlusOneButton',1)): ?>
		<!-- Google +1 Button -->
		<div class="itemGooglePlusOneButton">
		<div class="g-plusone" data-annotation="inline" data-width="150"></div>
		</div>
			<script >
				window.___gcfg = {
					lang: 'nl-NL',
					parsetags: 'onload'
				};
			</script>
<script src="https://apis.google.com/js/platform.js" async defer></script>
 
		<?php endif; ?>

Also the w3 validator says is w3 compliant
I hope it helps someone.
Best Regards Robin
Last edit: 9 years 2 months ago by Robin.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 2 months ago #140250 by Krikor Boghossian
Replied by Krikor Boghossian on topic [SOLVED]K2 Google+ button not working with RokBooster.
Awesome :)
Thanks for sharing this Robin

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum