![]() |
Twitter - Tweet Button in SHOWTHREAD
1 Attachment(s)
Twitter released their new TWEET button.
Live Demo: http://www.juot.net/forums/showthread.php?t=41185 (Update I have for the time being replaced the Tweet button with the Add This share button on my live forum. See the screen shots instead.) I have tested this in latest versions of IE / Firefox / Chrome / Opera / Safari. This will show you how to add this simple code to your SHOWTHREAD template below the page navigation bar, if visible. Go to the Admin CP -> Styles & Templates -> Style Manager Edit your SHOWTHREAD Template Find: Code:
<if condition="$show['pagenav']"><td align="$stylevar[right]">$pagenav</td></if> Code:
<td align="$stylevar[right]"><if condition="$show['pagenav']">$pagenav</if> Valid Examples: <if condition="!in_array($GLOBALS[forumid], array(2, 5, 9))"> <if condition="!in_array($GLOBALS[forumid], array(7))"> <if condition="!in_array($GLOBALS[forumid], array(2, 3, 4, 5, 6, 7, 8))"> If none of your forums are private or you want to enable this in every forum you can remove the lines: Code:
<if condition="!in_array($GLOBALS[forumid], array(X, Y, Z))"> When you hit the Tweet button you will be given a box to type a message if you're logged in. If you're not logged in you will be asked to login or join, all within the pop-up window. This button code will count the number of tweets people have made using it. I will add more options in later posts. Note- My Screenshot also has the Facebook Like button available as a separate mod here by someone else. If you don't have the facebook like button your Tweet button will be on the right of the page. There is also a basic skin screen shot. Please click Install if you use this. :) NEW UPDATE!!! Use this code instead it will force the correct URL to Twitter and solve the issue with a different URL being tweeted if thread is tweeted as soon as it's posted. Code:
<td align="$stylevar[right]"><if condition="$show['pagenav']">$pagenav</if> |
To have just a Tweet button and no count use the following code instead:
Code:
<td align="$stylevar[right]"><if condition="$show['pagenav']">$pagenav</if> |
thanks! I'm trying also to get the Like button next to it, what code are you using overall?
|
My exact code is:
Code:
<td align="$stylevar[right]"><if condition="$show['pagenav']">$pagenav</if> |
thanks for this, I've been using the tweetmeme button, but want to switch it over to the official button soon.
this reminded me :) |
I'll wait a while before implementing this. I would love to install it, but I'm concerned about security.
|
Quote:
1) Be corrected by Twitter ASAP with no work necessary on your part since this links to twitter's server to download the script. and 2) Would be limited to, perhaps, security of your twitter account- not the forum in general. |
Okie dokie.
So now I'm going to be geared towards SEO because I've got vbSEO installed. And this includes your version of the facebook "like." |
This does not include facebook 'like' - I only posted that code in response to a specific question. Copying it won't help you unless you follow the instructions in the facebook mod I linked to.
|
For some reason the counter keeps getting reset to 0...
When ever I click on the counter to search Twitter, it says "No results found" - but when I go to my twitter profile page I can see what I've tweeted. I'm running 3.8.6 with C-Logic SEO if that helps. |
I'd bet the SEO is the problem... the link being submitted to twitter is the non SEO link, but when you visit the thread you are visiting from a different URL so the counter is zero and always will be.
I noticed the same issue if you tweet a post immediately after you submit it... when you submit a post the URL has the post number appended to the end of the URL, when you browse the thread from a forum though there is no post number just thread id so it's a different URL so the counter is different. The way around this I believe would be to use a canonical link tag in the header but that would be very bad for your SEO purposes because you want the 'seo optimized' url not the vb default one. |
Quote:
For now, I've removed the counter from the Tweet button. It's still a great modification none the less. |
this is great thanks ;)
|
If anyone is using this like I do with the Facebook Like button I added the following code so that the tweet button is centered vertically with the facebook button...
put a <div> around the tweet button code- Code:
<div style="padding-bottom:8px;"> Original Tweet Button Code Here </div> |
I have a very odd problem .. The twitter icon doesn't show up in 2 of my forums on any threads .. there is absolutely no difference in these forums in the Forum Manager, or Forum Permissions. They are set up the exact same way - the only difference is the name of the forum that I can tell. The icon just doesn't show up at all. Any ideas?
|
Quote:
Code:
<if condition="!in_array($GLOBALS[forumid], array(X, Y, Z))"> Code:
<if condition="!in_array($GLOBALS[forumid], array(11, 12, 20, 58))"> Code:
<if condition="!in_array($GLOBALS[forumid], array(6))"> If you don't have any forums in which you don't want to display the tweet button I give yo the two lines to remove in the instructions. |
Thanks this is cool. I instantly got traffic when I tweeted my threads. not sure if they are bots or real people but at least the links are getting out there :)
|
I added this and the Facebook button at the same time and people freaked out at seeing their Facebook (Real) name on the forum. Even though only their friends can see that, it made them uncomfortable.
I may add the Tweet button back on. |
Quote:
|
I know and I tried to explain it, but I know that if they aren't comfortable with it, they won't use it.
On my forum, there are a lot of local teachers and city workers who post about their jobs and they are just paranoid that their bosses and co-workers will be able to identify them. If the Facebook note showed that their Username liked it, they would probably be ok with it. I was hoping to use it to generate traffic to the site. Adding the Tweet link back now. Thanks |
How to show 'tweet' button on forum home as in forums.digitalpoint.com?
Have anybody checked this in VB 4.0.6? |
The 4.0.x version of this mod is here: https://vborg.vbsupport.ru/showthread.php?t=248569
Digitalpoint looks like they added the twitter code to one of their breadcrumb templates... You can add it directly below "Forum" (on their page) by adding the code to FORUMHOME template right below the navbar code- so something like: Code:
{vb:raw navbar} |
Thanks Mate !:up:
|
Is there a way to add this on postbit_legacy?
|
If you add this to postbit legacy you'd be tweeting single posts, not threads... but if you really want to...
In Postbit Legacy Find: Code:
<!-- controls --> Code:
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-url="http://www.juot.net/forums/showthread.php?$session[sessionurl]p=$post[postid]&postcount=$post[postcount]" data-via="YOUR_TWITTER_USERNAME">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> |
Using 3.8.4 and the Tweet counter doesn't work. I also get an error :
"stack overflow : Line 1" when putting on but i just click ok and the error goes away. How would you add these buttons to forum home on 3.8.x ? Great addition and great for driving free traffic |
Where are you getting that error?
As for the counter not working I'm guessing it's because the URL is different when you first submit a new thread or past than it is when you browse to the thread later, so twitter is counting it a different URL. I'm working on a fix for this. |
hi. thank you so much for posting this.
i just installed this and i am trying to get the twitter button beside my fb button..here is my code. what did i do wrong? thanks :) <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="Billyne">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> </td></td> <iframe src="http://www.facebook.com/plugins/like.php?href=http://www.nailtechalley.com/forums/showthread.php$session[sessionurl]?t=$threadid" &show_faces=false&width=350&action=lik e&colorscheme=dark&height=30" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:350px; height:30px;" allowTransparency="true"></iframe> </td></tr></table> </if> </td> <!-- / controls above postbits --> |
@birdofprey - iget that error when the tweet page pops up. I tried on laptop and i dont get that error, only on my main pc. Main PC is running XP and IE7 and laptop is running Vista and IE8. Not sure if thats anything to do with it.
Tweet button now counting tweets though after i moved it from postbit_legacy to showthread. Brilliant addition !! |
I do not understand why the button is down the pages.
How do I place above them? Image: https://vborg.vbsupport.ru/ |
Quote:
Code:
<!-- controls above postbits --> |
Quote:
Unfortunately the error you're getting in your main pc sounds like an issue local to your system- I'd recommend upgrading to the latest IE... It's also possible firewall or anti-malware software you may be running is blocking part of the script and causing the error- it could be anything. :( Quote:
If you want to try, experiment with putting the twitter code before the line: Code:
<td align="$stylevar[right]"><if condition="$show['pagenav']">$pagenav</if> |
I've added updated code to the first post that will fix the counter issue/wrong URL issue.
|
thanks!
|
Hi.
How do I place the tweet button beside the page navigation? (so that [tweet button] [page navigation]) |
I never really tried that but I'll play with it and let you know.
|
OK for Next to the Page Nav menu do the following.
In SHOWTHREAD find the line: Code:
<if condition="$show['pagenav']"><td align="$stylevar[right]">$pagenav</td></if> Code:
<td align="$stylevar[right]"> |
Very awesome. Thank you very much, BirdOPrey.
|
BirdOPrey, I really wanna get that facebook LIKE link next to the Twitter one, and placed where you have them because those are the best spots IMO, I have the Twitter one in place but not sure what coding needs to be placed to do so.
|
1 Attachment(s)
Quote:
Code:
<td align="$stylevar[right]"><if condition="$show['pagenav']">$pagenav</if> You'll have to customize the forumids and the twitter specifics and add your facebook like code to "FACEBOOK LIKE CODE HERE" but it will look good. :up: |
All times are GMT. The time now is 01:30 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|