Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • Alp Friend
    #922047

    Hello everyone,

    I have tweet function in k2 items. But tweets do not include URL.
    Please help,
    What do I do wrong?

    Best regards,

    Alp

    Saguaros Moderator
    #922370

    Hi Alp,

    When I tried to click the Tweet button, it shows the link you want to share: http://nimb.ws/seirEO

    Is that correct?

    Alp Friend
    #922392

    When I click the tweet button I can see only title without any url or link.

    Best case would be title + link(url)


    1. tweett
    Saguaros Moderator
    #922762

    Which plugin are you using for this twitter button?

    Alp Friend
    #922845

    No plugin,

    I implemented following code directly into: /html/com_k2/ja_wall/item.php

    <?php if($this->item->params->get('itemTwitterButton',1) || $this->item->params->get('itemFacebookButton',1) || $this->item->params->get('itemGooglePlusOneButton',1)): ?>
        <!-- Social sharing -->
        <div class="itemSocialSharing">
            <?php 
                $datahref = str_replace('tmpl=component', '', $this->item->absoluteURL);
                $datahref = str_replace(array('&&', '?&'), array('&', '?'), $datahref);
                $datahref = rtrim($datahref, ' ?&');
                $datahref = urlencode($datahref);
            ?>
    <?php if($this->item->params->get('itemTwitterButton',1)): ?>
            <!-- Twitter Button -->
            <div class="itemTwitterButton">
                <a href="https://twitter.com/share" data-url="<?php echo $datahref ?>" 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">&lt;/script&gt;
            </div>
            <?php endif; ?>&nbsp;
    
            <?php if($this->item->params->get('itemFacebookButton',1)): ?>
            <!-- Facebook Button -->
            <div class="itemFacebookButton" style="padding-left:5px">
                <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/tr_TR/all.js#xfbml=1";
                      fjs.parentNode.insertBefore(js, fjs);
                    }(document, 'script', 'facebook-jssdk'));
                &lt;/script&gt;
                <div class="fb-like" data-href="<?php echo $datahref ?>" data-send="false" data-width="270" data-show-faces="true"></div>
            </div>
            <?php endif; ?>
    
          <div align=center style="padding-right: 5px;" class="fb-share">
    <fb:share-button type="button" href="<?php echo JURI::getInstance()->toString(array('scheme', 'host', 'port')) . $this->item->link; ?>" width="70" height="20"></fb:share-button>
    </div>
    
            <?php if($this->item->params->get('itemGooglePlusOneButton',1)): ?>
            <!-- Google +1 Button -->
            <div class="itemGooglePlusOneButton"> 
                <g:plusone data-href="<?php echo $datahref ?>" annotation="inline" width="120"></g:plusone>
                <script type="text/javascript">
                  (function() {
                    window.___gcfg = {lang: 'tr'}; // 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);
                  })();
                &lt;/script&gt;
            </div>
            <?php endif; ?>
    
            <div class="clr"></div>
        </div>
        <?php endif; ?>
    
    Saguaros Moderator
    #923221

    Did you try to implement into default K2 item and see how it goes?

Viewing 6 posts - 1 through 6 (of 6 total)

This topic contains 5 replies, has 2 voices, and was last updated by  Saguaros 8 years, 7 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum