PDA

View Full Version : Tweet Per-Post



s0ct0j0c
21-04-2011, 02:26 PM
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:




<xen:if is="{$xenOptions.tweet.enabled}">
<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>

Go to your message_user_info template and look for this at the bottom:




<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:


.messageUserInfo .tweet { margin-top: 10px; }
The end result looks like this:

http://xenforomods.info/attachments/under_avatar-png.7101/?embedded=1

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:



<xen:if is="{$xenOptions.tweet.enabled}"><a href="http://twitter.com/share?url={xen:link canonical:posts, {$post}}" target="_blank" class="item control tweet">{xen:phrase tweet}</a></xen:if>
Then go to post template. Find this section:


<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:

http://xenforomods.info/attachments/under_avatar-png.7101/?embedded=1

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. http://xenforomods.info/styles/default/xenforo/smilies/smile.png

Thanks to King Kovifor for pointing something out and OperaManiac for the lead on being able to make the link-only option.