Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.5k views
in Q2A Core by
How can I colorize zero answer boxes? e.g Display it in another color

3 Answers

+4 votes
by
edited by
 
Best answer

Create an advance theme as described here and then copy the function "a_count" in qa-theme-base in your qa-theme.php. If $post['answers_raw'] == 0, you can insert a different style that you will then color in your css. Something like that should do:

$style=null;

if ($post['answers_raw'] == 0)

$style='qa-a-count-none';

else if (  @$post['answer_selected'])

$style='qa-a-count-selected';

$this->output_split(@$post['answers'], 'qa-a-count', 'SPAN', 'SPAN', $style);

by
Many Thanks I'll give it a try.
by
an error comes in my website when i am using ur code in line :
else if (  @$post['answer_selected'])

The Error is parse error : syntex error, unexpected T_STRING In  Uper line
by
Looks like a typo, couldn't see it but comment out this part of the code to be sure its from there.
by
see in 3 answer of this questions i post problem with image...   open image in new tab ans see...
by
I saw your image before. But suddenly the typo showed: there's a missing single quote on line 1379.
by
what i do now...
by
I've fixed my answer. Just add the missing single quote on line 1379 of your code...
by
thanx it works now.....
by
When i Use Your Code An Error Occours i Send u a Image of error  Please help me

Notice: Undefined index: answers_raw in /public_html/qa-include/qa-theme-base.php on line 1378

And The Line 1378 is :

if ($post['answers_raw'] == 0)
0 votes
by
edited by
Create an advanced theme as described here and then add or modify this function:

 

function a_count($post){
if ($post['answers_raw'] > 0){
$style='has-posts';
}
if (@$post['answer_selected']){
$style='has-selected';
}
$this->output_split(@$post['answers'], 'qa-a-count', 'SPAN', SPAN',$style,
@$post['answer_selected'] ? 'qa-a-count-selected' : null);
}

 

Now if you create and modify the css class .has-posts {} you can alter the appearance of your count block when there are posts added.

 

*tip .has-posts {something:changed !important;} (add !important) to overide existing css class.

 

Also if you create and modify the css class .has-selected {} you can alter the appearance of your count block when there is a selected post.
–1 vote
by
edited

When i Use Your Code An Error Occours i Send u a Image of error  Please help me

Notice: Undefined index: answers_raw in /public_html/qa-include/qa-theme-base.php on line 1378

And The Line 1378 is :

if ($post['answers_raw'] == 0) 

 

 

by
if (@$post['answers_raw'] == 0)
by
thanx @aleksiss
...