Change location of social sharing buttons

GK User
Wed Feb 22, 2012 1:09 pm
Hi,

On my articles i have the social share buttons enabled eg.
http://www.desispy.com/music/bollywood- ... music.html

under the tagged under line but how can i change the position of these twitter, facebook and google plus 1 buttons to the top of the page? i cant find the module for the social share buttons, thanks.
User avatar
Senior Boarder

GK User
Wed Feb 22, 2012 3:01 pm
Hi,

Open file: \templates\gk_game_magazine\html\com_k2\templates\default\item.php

Find:
Code: Select all
 <!-- Social sharing -->
           
            <div class="itemSocialSharing">
                <?php if($this->item->params->get('itemTwitterButton',1)): ?>
               
                <!-- Twitter Button -->
               
                <div class="itemTwitterButton">
                    <a href="https://twitter.com/share" class="twitter-share-button" data-count="horizontal"<?php if($this->item->params->get('twitterUsername')): ?> data-via="<?php echo $this->item->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($this->item->params->get('itemFacebookButton',1)): ?>
               
                <!-- Facebook Button -->
               
                <div class="itemFacebookButton">
                    <div id="fb-root"></div>
                    <script type="text/javascript">

                            (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 = "//connect.facebook.net/en_US/all.js#appId=177111755694317&xfbml=1";

                              fjs.parentNode.insertBefore(js, fjs);

                            }(document, 'script', 'facebook-jssdk'));

                        </script>
                    <div class="fb-like" data-send="false" data-width="260" data-show-faces="true"></div>
                </div>
                <?php endif; ?>
                <?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; ?>
                <div class="clr"></div>
            </div>
            <?php endif; ?>
        </div>
        <div class="clr"></div>
    </div>
    <?php endif; ?>
    <?php if($this->item->params->get('itemAuthorBlock') && empty($this->item->created_by_alias)):?>

Move it to after:
Code: Select all
    <!-- Plugins: AfterDisplayTitle -->
   
    <?php echo $this->item->event->AfterDisplayTitle; ?>


However, in my opinion, it's better to show the Share buttons at end of article, one would share your articles once he reads and likes them and wants to share to his friends...
User avatar
Platinum Boarder

GK User
Wed Feb 22, 2012 7:41 pm
Thanks, would it still work if I copied the code so its once after the title and once at the end of the article, twice on same page, would there been any issues with this?
User avatar
Senior Boarder

GK User
Wed Feb 22, 2012 10:00 pm
i made the change you said and got this error:

Parse error: syntax error, unexpected T_ENDIF in /homepages/6/d277799099/htdocs/desispy/templates/gk_game_magazine/html/com_k2/templates/default/item.php on line 277

please advise?
User avatar
Senior Boarder

GK User
Thu Feb 23, 2012 10:29 am
Yes you can display it twice like you want. You might paste it to wrong place so it showed the error message, can you give me FTP access via a PM then I can try for you?

Thanks,
User avatar
Platinum Boarder

GK User
Tue May 08, 2012 4:16 pm
Did this get resolved? The code block below is almost there but not totally right. I get a syntax error.
User avatar
Fresh Boarder

GK User
Thu May 10, 2012 12:48 am
Hi Quel,

Please let me take a look on your code by sending me a PM to provide FTP access.

Thanks,
User avatar
Platinum Boarder


cron