Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
1.7k views
in Q2A Core by
edited by
Does anyone know how to do that?

I already have most popular users in sidebar, but I also want the top 3 of hot questions in the sidebar... but I dont know how... maybe someone has already done it?

I will  be really grateful!!

5 Answers

+1 vote
by
 
Best answer

 

It's a pretty simple widget. We have something similar for our home page. I've adapted it here to work in the sidebar (I think):
 
<?php
 
class featured_questions {
 
function allow_template($template)
{
return true;
}
function allow_region($region)
{
return ($region=='side');
}
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
global $qa_db;
$query = "select p.postid, p.title, p.userid, p.acount, u.points from qa_posts as p, qa_userpoints as u where p.type = 'Q' and p.userid = u.userid order by p.hotness desc limit 3";
$result = mysql_query($query,$qa_db);
echo '<div class="featured">';
echo '<h2>Featured Questions</h2>';
while($row = mysql_fetch_assoc($result)){
$url = qa_path_html(qa_q_request($row['postid'], $row['title']));
echo '<h4><a href="' . $url . '">' . $row['title'] . '</a></h4>';
echo '<p>Question posted by ' . $row['userid'] . ' <span class="points">(' . $row['points'] . ' points)</span> Answers: ' . $row['acount'] . '</p>';
}
echo '</div>';
 
}
 
};
 
by
Hello could you explain where to put this code to make this work? Does it go into the index.php page?  Thanks
by
Thanks You. This is the answer I need
–3 votes
by
Stil no one who can help me out with this?

I want to list the top 3 hot questions in the sidebar...

I really will be grateful if someone can figure this out.

It's the final thing I want to have on my website. After this I can launch it.
by
good idea mate
by
I know! :-P But I don't know how to do that.
–3 votes
by
Up! There has to be someone who has done this before, right?! :-)
by
Dude, stop bumping and answering your own question! You're more likely to get answers if you left it unanswered.
by
More likely to get answers if I leave it unanswered? Where do you base that on? Don't you reckon with: bumping  = getting attention to the question = more likelihood of getting an answer.
by
Well my logic was that the question would show up in the Unanswered section. As it is you are adding useless posts, but whatever.
0 votes
by
Theres a feed widget. Use it to show hot questions feed.
0 votes
by

A bit old question but there's still some people asking how to display popular questions in sidebar.

There's a Q2A plugin for that developed by q2apro. Try it out: q2apro-popular-questions-widget

...