The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Twitter - Tweet Button in SHOWTHREAD Details »» | |||||||||||||||||||||||||||||||||
Twitter - Tweet Button in SHOWTHREAD
Developer Last Online: Aug 2023
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> <if condition="!in_array($GLOBALS[forumid], array(X, Y, Z))"> <table border="0"> <tr><td> <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="YOUR_TWITTER_USERNAME">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> </td></tr></table> </if> </td> 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))"> and </if> (The second one) 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> <if condition="!in_array($GLOBALS[forumid], array(X, Y, Z))"> <table border="0"> <tr><td> <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="YOUR_TWITTER_USERNAME" data-url="$vboptions[bburl]/showthread.php?t=$thread[threadid]">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> </td></tr></table> </if> </td> Download Now
Screenshots
Show Your Support
|
Благодарность от: | ||
mary_rose082198 |
Comments |
#52
|
||||
|
||||
I recommend using this line for the Twitter code, you'll note it has the data-url attribute the original code does not. This will force Twitter to count and link to the page via a single URL- it will not vary based on how the user is browsing the page...
Code:
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="YOUR_TWITTER_USERNAME" data-url="$vboptions[bburl]/showthread.php?t=$thread[threadid]">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> |
#53
|
|||
|
|||
Thanks for posting this! Took me awhile to get it where I wanted it (put it in my postbit legacy) and getting it lined up.
|
#54
|
|||
|
|||
How do you install this next to Thread Tools like the Demo Site?
|
#55
|
||||
|
||||
To do it next to thread tools like currently in the demo (March 2011):
Edit SHOWTHREAD template... FIND the code below and ADD the code in RED Code:
<td class="tcat" width="100%"> <div class="smallfont"> <if condition="$show['firstunreadlink']"> <a href="$firstunread"><img class="inlineimg" src="$stylevar[imgdir_button]/firstnew.gif" alt="$vbphrase[view_first_unread]" border="0" /></a> <a href="$firstunread"><strong>$vbphrase[view_first_unread]</strong></a> </if> </div> </td> <td class="vbmenu_control" id="threadshare" nowrap="nowrap"> ------TWITTER CODE HERE----- </td> <td class="vbmenu_control" id="threadtools" nowrap="nowrap"> <a href="$show[nojs_link]#goto_threadtools"<if condition="is_browser('ie')"> accesskey="3"</if>>$vbphrase[thread_tools]</a> <if condition="$show['popups']"><script type="text/javascript"> vbmenu_register("threadtools"); </script></if> </td> |
#56
|
|||
|
|||
Thank you, got it working.
|
#57
|
|||
|
|||
Quote:
|
#58
|
||||
|
||||
I don't have access to VBSEO sorry. You can disable the count from showing by changing data-count="horizontal" to data-count="none" in the code. Another option would be to ask in the VBSEO forum if anyone has the tweet button working. This is just the standard install instructions from Twitter, there's not much I can do about it.
|
#59
|
|||
|
|||
Quote:
Doing this is going to post the link for viewing a single post correct? If yes, is there a way to do this so that you can tweet the single post but instead of the link taking you to the view single post it takes you to the section of the thread that has that post? Hope that makes sense.. EDIT: Never mind figured it out on my own.. |
#60
|
|||
|
|||
thanks!
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|