News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

[TIP/TRICK] Adding Twitter and Facebook "Share/Like" Button To Posts

Started by JBlaze, June 12, 2011, 06:25:57 PM

Previous topic - Next topic

alchimia

Quote from: JBlaze on August 05, 2011, 06:52:31 AM
Quote from: ph4ntom on August 05, 2011, 06:24:16 AM
Nice tip, but i have one OT question. What's the name of this theme (from screenshot from first post) ?
It's a modified version of Dziner's Inferno theme.
Can we have this modified version?

simon36

Does anyone have the code all together to add facebook, twitter and g+1 on to the last post?

Thanks in advance.


JBlaze

Updated to include Google Plus, as well as neatening up and clarified a few things.
Jason Clemons
Former Team Member 2009 - 2012

graaywolf

J...

GraayWolf here

added your edits and it works fine except the facebook share window is half hidden... you have to guess that what your typing is not a typo lol....

no attachments option I guess so I can't give you a screenshot... come into my stickam chat and i'll show ya what's happening....

I'm trying...

-=(GW)=-

JBlaze

Quote from: graaywolf on June 11, 2012, 02:06:07 PM
J...

GraayWolf here

added your edits and it works fine except the facebook share window is half hidden... you have to guess that what your typing is not a typo lol....

no attachments option I guess so I can't give you a screenshot... come into my stickam chat and i'll show ya what's happening....

That's because the share window is bigger than the containing div. If it were made any bigger, it would throw off the layout and make things looks like hell. There' no real way to fix it that I can think of.
Jason Clemons
Former Team Member 2009 - 2012

kimjhamilton

Don't suppose you have the coding to share to Tumblr as well, cause that would be awesome.

GraphicJunki

This worked for me on most of my themes.  Great tip  thanks. :)


Nickyy

Thank you JBlaze for the tip/trick :)
I have
SMF Package       SMF 1.1.19
Sources                    2.0    1.1.19
Default Templates    2.0    1.1.12
Language Files    2.0    1.1.18
Current Templates    2.0    1.1

The result from adding the code is only a hyperlink to twitter with the word 'Tweet'. Screenshot:



eric1234

For some reason it work well in Firefox but in Google Chrome it seem to be malfunction.  :(

Paracelsus

Ok, here's a question: if you want to put a facebook/google+/twitter share link to a POST (not a whole topic or topic page) how to do it?

Paracelsus

Ok, I can answer myself to this one... ;D

In the end I could achieve a working link for each post by using:
', $scripturl, '?topic=', $context['current_topic'], '.msg' . $message['id'] . '%23msg' . $message['id'] . '

That code is to be put right after the desired facebook/twitter/google+/etc link, for example:
https://www.facebook.com/sharer/sharer.php?u=', $scripturl, '?topic=', $context['current_topic'], '.msg' . $message['id'] . '%23msg' . $message['id'] . '"

You can check it out how it works live here: http://www.forumscp.com/index.php?topic=64983.20 (notice the share icon on top right-corner of each post)

Johnson12


njtweb

Quote from: Nickyy on November 08, 2013, 05:04:09 AM
Thank you JBlaze for the tip/trick :)
I have
SMF Package       SMF 1.1.19
Sources                    2.0    1.1.19
Default Templates    2.0    1.1.12
Language Files    2.0    1.1.18
Current Templates    2.0    1.1

The result from adding the code is only a hyperlink to twitter with the word 'Tweet'. Screenshot:

Any help on this? I have the same problem. I added this today on the "Flatline" theme. I edited the default "display.template.php" file because my theme doesn't have one. Then I edited my themes "index.template.php" file, as the OP instructs to do so.

The result....Just the text "Tweet", that's it.

Any help is greatly appreciated.

njtweb

Quote from: njtweb on June 10, 2015, 03:57:44 PM
Quote from: Nickyy on November 08, 2013, 05:04:09 AM
Thank you JBlaze for the tip/trick :)
I have
SMF Package       SMF 1.1.19
Sources                    2.0    1.1.19
Default Templates    2.0    1.1.12
Language Files    2.0    1.1.18
Current Templates    2.0    1.1

The result from adding the code is only a hyperlink to twitter with the word 'Tweet'. Screenshot:

Any help on this? I have the same problem. I added this today on the "Flatline" theme. I edited the default "display.template.php" file because my theme doesn't have one. Then I edited my themes "index.template.php" file, as the OP instructs to do so.

The result....Just the text "Tweet", that's it.

Any help is greatly appreciated.

Turns out, my company is blocking twitter and fb. I got home and both show in the post, but no G+

gusu

I'm using the Avada theme. Can I implement this technique safely on it?

Advertisement: