Keyword

How can I place social share icon on category list

  • Diogo Alberto
  • Diogo Alberto's Avatar Topic Author
  • Offline
  • New Member
More
10 years 5 months ago - 10 years 5 months ago #119886 by Diogo Alberto

Attachment not found



Hello, how can I do that? So i can put social share links on category list... like other blogs.

See the screenshot please

King Regards

Attachment not found

Attachments:

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 5 months ago #119887 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: How can I place social share icon on category list
You need to edit your template's category_php file.

Open the item.php file and copy all the social code WITHOUT the php stuff, just the HTML and JS.

Paste the code where you want to appear in the category_item.php file. Some styling might be needed in order to align the buttons.

Now you need to manually specify a link for each social button.

For the like button add
data-href="<?php echo $this->item->link; ?>"

Full instructions and options are located here: developers.facebook.com/docs/plugins/like-button/

for twitter add
data-url="<?php echo $this->item->link; ?>"
to the buttons's code

All options are located here: Invalid consumer key/secret in configuration

Finally for G+ add
data-href="<?php echo $this->item->link; ?>"
to the button's code

developers.google.com/+/web/+1button/ for more options.

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

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

  • Diogo Alberto Caixeta
  • Diogo Alberto Caixeta's Avatar
  • Offline
  • New Member
More
10 years 2 months ago #119888 by Diogo Alberto Caixeta
Replied by Diogo Alberto Caixeta on topic Re: How can I place social share icon on category list

Diogo Alberto wrote:

Attachment not found



Hello, how can I do that? So i can put social share links on category list... like other blogs.

See the screenshot please

King Regards

Attachment not found



thanks I will try now.

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

  • Diogo Alberto Caixeta
  • Diogo Alberto Caixeta's Avatar
  • Offline
  • New Member
More
10 years 2 months ago #119889 by Diogo Alberto Caixeta
Replied by Diogo Alberto Caixeta on topic Re: How can I place social share icon on category list

Krikor Boghossian wrote: You need to edit your template's category_php file.

Open the item.php file and copy all the social code WITHOUT the php stuff, just the HTML and JS.

Paste the code where you want to appear in the category_item.php file. Some styling might be needed in order to align the buttons.

Now you need to manually specify a link for each social button.

For the like button add

data-href="<?php echo $this->item->link; ?>"

Full instructions and options are located here: developers.facebook.com/docs/plugins/like-button/

for twitter add
data-url="<?php echo $this->item->link; ?>"
to the buttons's code

All options are located here: Invalid consumer key/secret in configuration

Finally for G+ add
data-href="<?php echo $this->item->link; ?>"
to the button's code

developers.google.com/+/web/+1button/ for more options.


hello mate, thanks for the updated.. but did something wrong help me please..

with facebook all good.. but with twitter and g+ no.

GOOGLE +

<div class="g-plusone" data-annotation="inline" data-width="300" data-href="<?php echo $this->item->link; ?>"></div>

TWITTER

data-url="<?php echo $this->item->link; ?>" >Tweet</a>

can u help? thank you in advanced

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

More
10 years 2 months ago #119890 by Lefteris
@Diogo Alberto Caixeta

Add the following code in line 15 of your category_item.php:
$this->item->absoluteURL = JRoute::_(K2HelperRoute::getItemRoute($this->item->id.':'.$this->item->alias, $this->item->catid), true, -1);

Then in the social links code use the :
<?php echo $this->item->absoluteURL; ?>

instead of :
<?php echo $this->item->link; ?>

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

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

More
7 years 9 months ago #156468 by Gorast
Works like a charm! :D
Thanks!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 9 months ago #156471 by Krikor Boghossian
Replied by Krikor Boghossian on topic How can I place social share icon on category list
Thanks Gorast :)

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

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

More
7 years 8 months ago #156655 by marco
Guys in TAG page and USER page I can't get the Absolute path.
Could you please suggest the code to put at the beginning of user.php/tag.php in order to get the ABSOLUTE PATH?

I'm using the social link below to share on facebook the items showed on user.php/tag.php :
<a href="https://www.facebook.com/sharer.php?u=<?php echo $item->absoluteURL; ?>" target="_blank"> Facebook</a>
Best,
Rob

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 8 months ago #156670 by Krikor Boghossian
Replied by Krikor Boghossian on topic How can I place social share icon on category list
Hello Rob,

$item->link should be instead, with the domain as a prefix, since $item->absoluteURL; is not available in these views.

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