Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
530 views
in Q2A Core by
How can you change the color of the answers on the questions page when a question is answered. for example: Green when it has 1-10 answers red if it has 0 and gold if it has 10+

1 Answer

+1 vote
by
edited by
 
Best answer
Use an advanced theme: http://www.question2answer.org/advanced.php#theme-advanced

In qa-theme.php in your theme directory, override the function a_count($post), something like this (code not tested):

function a_count($post)
{
  if (@$post['answers']['data']>10)
    $this->output_split($post['answers'], 'qa-a-count-many');
  else if (@$post['answers']['data']>0)
    qa_html_theme_base::a_count($post);
  else
    $this->output_split(@$post['answers'], 'qa-a-count-zero');
}

Then add some new CSS classes to qa-styles.css in your theme directory which match the HTML output for the different cases, changing the color as appropriate.
by
OK - and now?
by
edited by
Yes! Thank you so much, finally nailed it! Heres the css i used, i changed it a little to look like stackexchange :P but thats not what i have on my site:

==========
New Classes:
==========

/* Question Colors */

.qa-a-count-zero {background:#9A4443; text-align:center; float:left; margin:0 3px 0 0; padding:5px; width:46px; height:38px; overflow:hidden; margin-right:1.5em;}
.qa-a-count-many {background:#F9850E; text-align:center; float:left; margin:0 3px 0 0; padding:5px; width:46px; height:38px; overflow:hidden; margin-right:1.5em;}
.qa-a-count-zero-data {font-size:24px; font-weight:bold; color : #fff;}
.qa-a-count-zero-pad {font-size:11px; color : #fff;}
.qa-a-count-many-data {font-size:24px; font-weight:bold; color : #fff;}
.qa-a-count-many-pad {font-size:11px; color : #fff;}

===============
Old Classes Modified:
===============

/* Answer count */

.qa-a-count {background:#75855E; text-align:center; float:left; margin:0 3px 0 0; padding:5px; width:46px; height:38px; overflow:hidden; margin-right:1.5em;}
.qa-a-count-data {font-size:24px; font-weight:bold; color : #fff;}
.qa-a-count-pad {font-size:11px; color : #fff;}

===
and
===

/* Votes */

/* qa-*-hover classes are substituted by JS (for IE), qa-*-button:hover is a backup for other browsers if JS is off */

.qa-voting {background-color:#EEEEEE; margin-right:3px; float:left; height:38px; overflow:hidden; padding:5px 0; }
.qa-vote-buttons {float:left; width:18px; padding-left:12px;}
by
OK, I added another @ in the answer to address this.
by
Alright, we got it now :P
...