Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+8 votes
583 views
in Q2A Core by
Is it possible to show if a question has a best answer on index pages? for example it shows if it has answers posted and has a class of "qa-q-item-what" but i want to show an icon if the question has a best answer only.

1 Answer

+2 votes
by
edited by
 
Best answer

It's not immediately possible and you'd need to do a couple of small PHP things.

First, in qa-db-selects.php, move the following line out of the if (...) it's within:

$selectspec['columns'][]='^posts.selchildid';

(This will be done in the next release of Q2A anyway.)

Second, create an advanced theme, and override the appropriate function, depending on where you want the icon. Perhaps post_meta_what() in which case your copy of the function should include the following code:

if (isset($post['raw']['selchildid'])) {

$this->output('HTML CODE TO DISPLAY YOUR ICON');

}

by
It Worked perfectly. Thank you
by
From 1.5.4 on there is a CSS class .qa-a-count-selected added to the answer count field.

You could use CSS3 to add "best answer selected" to the answer field using:

.qa-a-count-selected:afte.qa-q-list-item {
position:relative;
}
.qa-a-count-selected:after {
font-size:10px;
color:#FFA540;
content:"Best selected";
position:absolute;
left:153px;
top:95px;
width:35px;
}

OR as stated in the question to change the background color:

.qa-a-count-selected {
  background:#FFCCCC;
}
...