Social API settings work in Joomla Articles not K2 items

GK User
Tue Nov 24, 2015 7:01 pm
We are using University Template for our website http://www.3cushionbilliards.com We use K2 items for the news sections that we post. We use standard Joomla articles for other sections of the site. We made changes to Social API settings in the template. Our changes appear as expected in standard Joomla articles. The changes did not affect social share buttons in K2 items. Are social share buttons in K2 items controlled differently? How can we make changes to appearance of social share buttons for K2 items?

Example Joomla article (buttons appear correct) http://www.3cushionbilliards.com/about-us

Example K2 Item (buttons are different) http://www.3cushionbilliards.com/news/w ... rd-masters

Thanks!
User avatar
Junior Boarder

teitbite
Thu Nov 26, 2015 1:53 pm
Hi

I do not know what changes to the code You've done exactly, but please try include them in /html/com_content/article/default.php file as well. Code for social icons used looks like this:

Code: Select all
          <gavern:social><div id="gkSocialAPI"></gavern:social>
             <gavern:social><div><g:plusone GK_GOOGLE_PLUS_SETTINGS callback="<?php echo $cur_url; ?>"></g:plusone></div></gavern:social>
             <gavern:social><div><g:plus action="share" GK_GOOGLE_PLUS_SHARE_SETTINGS href="<?php echo $cur_url; ?>"></g:plus></div></gavern:social>
             <gavern:social><div><fb:like href="<?php echo $cur_url; ?>" GK_FB_LIKE_SETTINGS></fb:like></div></gavern:social>
             <gavern:social><div><a href="http://twitter.com/share" class="twitter-share-button" data-text="<?php echo $this->item->title; ?>" data-url="<?php $cur_url; ?>"  gk_tweet_btn_settings>Tweet</a></div></gavern:social>
             <gavern:social><div><a href="http://pinterest.com/pin/create/button/?url=<?php echo $cur_url; ?>&amp;media=<?php echo $pin_image; ?>&amp;description=<?php echo str_replace(" ", "%20", $this->item->title); ?>" class="pin-it-button" count-layout="GK_PINTEREST_SETTINGS"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="<?php echo JText::_('TPL_GK_LANG_PINIT_TITLE'); ?>" /></a></div></gavern:social>
           <gavern:social></div></gavern:social>
User avatar
Moderator

GK User
Fri Nov 27, 2015 9:25 pm
Sorry if my original message was unclear... I did not make any "code" changes.

What I did do was much simpler. I merely entered different selections to the preferences in the social API settings tab of the template using the standard admin interface (Extensions > Templates > gk_university > Social API) The result is that the icons for twitter, facebook, and google+ display correctly in a standard Joomla article.

However, in a K2 item the social share icons look different and apparently were not affected by the settings I entered in the social API tab.

So my question re-stated might be: Where are the display characteristics for social share icons controlled for K2 items?
User avatar
Junior Boarder

teitbite
Sat Nov 28, 2015 6:49 pm
Hi

Now I understand. K2 has it's own code for social buttons. Code can be found in /html/com_k2/templates/default/item.php
Code: Select all
          <?php if($params->get('itemTwitterButton',1) || $params->get('itemFacebookButton',1) || $params->get('itemGooglePlusOneButton',1)): ?>
          <div class="itemSocialSharing">
                    <?php if($params->get('itemTwitterButton',1)): ?>
                    <div class="itemTwitterButton"> <a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal"<?php if($params->get('twitterUsername')): ?> data-via="<?php echo $params->get('twitterUsername'); ?>"<?php endif; ?>><?php echo JText::_('K2_TWEET'); ?></a>
                              <script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
                    </div>
                    <?php endif; ?>
                    <?php if($params->get('itemFacebookButton',1)): ?>
                    <div class="itemFacebookButton">
                              <script type="text/javascript">                                                         
                          window.addEvent('load', function(){
                             (function(){
                                   if(document.id('fb-auth') == null) {
                                      var root = document.createElement('div');
                                      root.id = 'fb-root';
                                      $$('.itemFacebookButton')[0].appendChild(root);
                                         (function(d, s, id) {
                                           var js, fjs = d.getElementsByTagName(s)[0];
                                           if (d.getElementById(id)) {return;}
                                           js = d.createElement(s); js.id = id;
                                           js.src = document.location.protocol + "//connect.facebook.net/<?php echo $fblang; ?>/all.js#xfbml=1";
                                           fjs.parentNode.insertBefore(js, fjs);
                                         }(document, 'script', 'facebook-jssdk'));
                                     }
                                }());
                            });
                          </script>
                              <div class="fb-like" data-width="150" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div>
                    </div>
                    <?php endif; ?>
                    <?php if($params->get('itemGooglePlusOneButton',1)): ?>
                    <div class="itemGooglePlusOneButton">
                              <div class="g-plusone" data-size="standard"></div>
                              <script type="text/javascript">                             
                            window.___gcfg = {lang: 'en'}; // Define button default language here
                         
                            (function() {
                              var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
                              po.src = 'https://apis.google.com/js/platform.js';
                              var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
                            })();
                        </script>
                    </div>
                    <?php endif; ?>
          </div>
          <?php endif; ?>


try maybe replace it with the template's code for social

Code: Select all
  <gavern:social><div id="gkSocialAPI"></gavern:social>
             <gavern:social><div><g:plusone GK_GOOGLE_PLUS_SETTINGS callback="<?php echo $cur_url; ?>"></g:plusone></div></gavern:social>
             <gavern:social><div><g:plus action="share" GK_GOOGLE_PLUS_SHARE_SETTINGS href="<?php echo $cur_url; ?>"></g:plus></div></gavern:social>
             <gavern:social><div><fb:like href="<?php echo $cur_url; ?>" GK_FB_LIKE_SETTINGS></fb:like></div></gavern:social>
             <gavern:social><div><a href="http://twitter.com/share" class="twitter-share-button" data-text="<?php echo $this->item->title; ?>" data-url="<?php $cur_url; ?>"  gk_tweet_btn_settings>Tweet</a></div></gavern:social>
             <gavern:social><div><a href="http://pinterest.com/pin/create/button/?url=<?php echo $cur_url; ?>&amp;media=<?php echo $pin_image; ?>&amp;description=<?php echo str_replace(" ", "%20", $this->item->title); ?>" class="pin-it-button" count-layout="GK_PINTEREST_SETTINGS"><img border="0" src="//assets.pinterest.com/images/PinExt.png" title="<?php echo JText::_('TPL_GK_LANG_PINIT_TITLE'); ?>" /></a></div></gavern:social>
           <gavern:social></div></gavern:social>


I've never done that, but it's worth trying before making changes to K2 code for that part directly.
User avatar
Moderator


cron