Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
in Q2A Core by
edited by
What do you mean tweet button?
i think he means retweet or like a "bookmark this" thing to post a link and the title on  twitter - just a guess :P
you are right Dakota..any idea how to put it?

3 Answers

+3 votes
edited by
Best answer

I've figured this out and have gotten it to work on my site, follow these instructions carefully.

in your css theme file add:
#twitter {float:right; margin-top:-54px; margin-right:10px;}

in your css file edit (or similar) :  .qa-q-view-main {float:left; width:600px;}
and replace it with:  .qa-q-view-main {float:left; width:585px;}

in qa-includes/qa-theme-base.php add:  $this->output('<div id="twitter"><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script></div>');
on a new line directly after: case 'question':

Thats it, comment here if u have any other questions
edited by
its works great!!!
with this, i also can add facebook share.. horeey!!!
Great job, it worked perfectly. I only wish the Twitter website was faster loading. You can see this mod in action at http://www.askagamer.com
Where I should insert the could in version 1.3?
I'm having the same problem here. Case 'question' isn't in 1.3. Where's the similar place to put it?
+1 vote
edited by
Dakota is on the right track but there is a better way.

bottom of qa-style.css add:

#twitter {float:right; margin-top:-54px; margin-right:10px;}

qa-theme-base.php find:

case 'question':

Add after:

$this->output('<div id="twitter"><a class="retweet vert self" href=""></a></div>');

In Admin area:
In Custom tags in <HEAD> section of every page:


<script src="../../js/retweet.js"></script>

Ensure that the path is correct. We have QandA in its own folder, 1 up from root path. In root we have js folder.

Now you need to download this file :

Follow the instructions and voila, fixed.

To see it in action:

Click on one of the questions ;) the bit.ly url handles the link.

Have fun. Incidentally, we only downloaded this a few minutes ago, and so far very impressed. Hats off to gidgreen.

"Dakota is on the right track but there is a better way."

That is a matter of preference ^.^

Just glancing at the code it seems as everything in the custom head section will now be over there on the side, which in my opinion is inefficient.
No problems :) no skin off my nose. Perhaps you should check the code out "closer" ;)
+1 vote

Select the buttons and style you want on a site like www.addthis.com and copy sharing the code.

Use Q2A advanced theme editing (see more on that here: http://www.question2answer.org/themes.php#advanced ) to override the q_view_main function and paste the AddThis code to produce something like this: 



function q_view_main($q_view)
$this->output('<DIV CLASS="qa-q-view-main">');
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4d971b0a058477f1"></script>
<!-- AddThis Button END -->
$this->post_tags($q_view, 'qa-q-view');
$this->post_avatar($q_view, 'qa-q-view');
$this->post_meta($q_view, 'qa-q-view');
$this->c_list(@$q_view['c_list'], 'qa-q-view');
$this->c_list(@$q_view['a_form']['c_list'], 'qa-a-item');
$this->output('</DIV> <!-- END qa-q-view-main -->');
See the Tweet and FB buttons at work here: http://answers.techzim.co.zw/
Even better, override q_view_content($q_view) in your advanced theme, output the extra bit, and then call through to the inherited class using qa_html_theme_base::q_view_content($q_view) - that way it's much more likely for this to work in future versions. Or even better, look out for the develope preview of Q2A 1.4, and make a widget plugin...
Thank you :)