Onimua
Well-known member
This guide will let you put a Twitter button beside each post, allowing you to link to specific posts within a thread instead of the entire thread, or put a link to tweet beneath each post, whichever you prefer.
Displaying Tweet Link Beside a Post
Copy this code:
Go to your message_user_info template and look for this at the bottom:
Between the two </div> tags, past the code you copied before and save the template.
The last thing is to go into EXTRA.css and paste the following code in there as well:
The end result looks like this:
Displaying Tweet Link Under a Post
Alternatively, if you want to make a Tweet link to match the other links below the message, copy this code:
Then go to post template. Find this section:
Right before the closing </div>, paste the code you just copied.
The end result looks like this:
You can put the link wherever you want in the section of course, just look at the surrounding HTML and place it where you want.
Thanks to King Kovifor for pointing something out and OperaManiac for the lead on being able to make the link-only option.
Displaying Tweet Link Beside a Post
Copy this code:
HTML:
<xen:if is="{$xenOptions.tweet.enabled}">
<xen:if is="{$controllerName} == 'XenForo_ControllerPublic_Thread'">
<div class="tweet shareControl">
<a href="http://twitter.com/share" class="twitter-share-button"
data-count="horizontal"
data-lang="{xen:helper twitterLang, $visitorLanguage.language_code}"
data-url="{xen:link canonical:posts, {$post}}"
{xen:if {$thread.title}, 'data-text="{$thread.title}"'}
{xen:if {$xenOptions.tweet.via}, 'data-via="{$xenOptions.tweet.via}"'}
{xen:if {$xenOptions.tweet.related}, 'data-related="{$xenOptions.tweet.related}"'}>{xen:phrase tweet}</a>
</div>
</xen:if>
</xen:if>
Go to your message_user_info template and look for this at the bottom:
HTML:
<span class="arrow"><span></span></span>
</div>
CODE GOES HERE
</div>
Between the two </div> tags, past the code you copied before and save the template.
The last thing is to go into EXTRA.css and paste the following code in there as well:
HTML:
.messageUserInfo .tweet { margin-top: 10px; }
The end result looks like this:
Displaying Tweet Link Under a Post
Alternatively, if you want to make a Tweet link to match the other links below the message, copy this code:
HTML:
<xen:if is="{$xenOptions.tweet.enabled}">
<xen:if is="{$controllerName} == 'XenForo_ControllerPublic_Thread'"><a href="http://twitter.com/share?url={xen:link canonical:posts, {$post}}" target="_blank" class="item control tweet">{xen:phrase tweet}</a></xen:if>
</xen:if>
Then go to post template. Find this section:
HTML:
<div class="publicControls">
<a href="{xen:link threads/post-permalink, $thread, 'post={$post}'}" class="item muted postNumber hashPermalink" title="{xen:phrase permalink}">#{xen:calc '{$post.position} + 1'}</a>
<xen:if is="{$post.canLike}">
<a href="{xen:link posts/like, $post}" class="LikeLink item control {xen:if $post.like_date, unlike, like}" data-container="#likes-post-{$post.post_id}"><span></span><span class="LikeLabel">{xen:if $post.like_date, {xen:phrase unlike}, {xen:phrase like}}</span></a>
</xen:if>
<xen:if is="{$canReply}">
<a href="{xen:link threads/reply, $thread, 'quote={$post.post_id}'}" data-postUrl="{xen:link posts/quote, $post}" class="ReplyQuote item control reply" title="{xen:phrase reply_quoting_this_message}"><span></span>{xen:phrase reply}</a>
</xen:if>
CODE HERE
</div>
Right before the closing </div>, paste the code you just copied.
The end result looks like this:
You can put the link wherever you want in the section of course, just look at the surrounding HTML and place it where you want.
Thanks to King Kovifor for pointing something out and OperaManiac for the lead on being able to make the link-only option.