Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.1k 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
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
...