Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
893 views
in Themes by

hi every body

in snow theme there are two differents style for question visit count in qa list and qa page

in my theme i just can styling by

qa-view-count

and visit count changing in qa list and qa page together !!

please help me to make different style for each one 

thanks

Q2A version: 1.7

1 Answer

+2 votes
by

The trick is simple. Basically, you want style a style applied everywhere and a different style applied only when displaying a question. For this, you should use the class attribute of the body tag.

I haven't tested this but you could do something like:

.qa-view-count {
    color: blue;
}

.qa-template-question .qa-view-count {
    color: red;
}

So you first apply the style everywhere but then you apply the exception for the question view.

by
thanks , but i use this code :
.qa-template-question .qa-view-count {
position : absolute;
right : 0;
top : -20px;
float : right;
margin : 0;
padding : 0 0 2px;
width : auto;
height : auto;
color : #777;
border : 0;
background:red;
}
.qa-template-question .qa-view-count-data {
font-size : 11px;
line-height : 12px;
margin-top : 1px;
display : inline;
}
.qa-template-question .qa-view-count-pad {
font-size : 8px;
line-height : 8px;
letter-spacing : 1px;
}
it is not working !!
i check html codes , there is no qa-template-question in div classes
my theme :  http://www.question2answer.org/qa/27972/iconic-one-theme-for-q2a-beta-version?show=27972#q27972
this theme is look like my wp theme
how can i add this class to qa-theme.php ?
i found this codes in qa-theme.php :

        function q_item_stats($q_item) // add view count to question list
        {
            $this->output('<div class="qa-q-item-stats">');
           
            $this->voting($q_item);
            $this->a_count($q_item);
            qa_html_theme_base::view_count($q_item);

            $this->output('</div>');
        }
       
        function view_count($q_item) // prevent display of view count in the usual place
        {   
            if ($this->template=='question')
                qa_html_theme_base::view_count($q_item);
        }
??!!
by
i add this code and css working now :
if ($this->template=='question') {
$this->output('<body class="qa-template-question">');
} else {
$this->output('<body class="page-template-default">');
}
bit there is two view count in page one in the header !! and one in side of question !! how can i delete header one ?
by
i found the problem
when i use that code in qa-theme.php all view count (also related questions view count ) use question view count style!!
how can i fix it ?
in snow theme in related questions has no view count !
how can i remove vew count from related questions?
by
You're overcomplicating a very simple issue. The more PHP you change, the more issues you'll face now or in the future. You can solve this using CSS only, as I explained in the answer. My advice for you is to follow that approach
by
yes, i do that
.qa-view-count {
    color: blue;
}

.qa-template-question .qa-view-count {
    color: red;
}
but it is not working in my theme
it is working with :
if ($this->template=='question') {
$this->output('<body class="qa-template-question">');
} else {
$this->output('<body class="page-template-default">');
}
in qa-theme.php
and my problem is how to remove view count from related question widget !
please help about that
css cant work with this theme !
...