Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
588 views
in Q2A Core by
I am playing with the advanced theme and i am trying to add/remove some elements in the "Edit Question" view but i noticed  that has the same template class as the "Question Page" which is "qa-template-question". Is there any quick hack (even in the core) that it will allow me to add a unique template class for the edit question page ? eg "qa-template-question-edit"

@sama55 ?
Q2A version: 1.7.4

2 Answers

+2 votes
by
selected by
 
Best answer

You may be able to use "qa_get_state()" function.

Usage:

public function body_tags() {
    if($this->template == 'question' && strpos(qa_get_state(), 'edit')===0) {
        ob_start();
        qa_html_theme_base::body_tags();
        $output = ob_get_clean();
        $this->output(str_replace('qa-template-question', 'qa-template-question qa-template-question-edit', $output));
    } else
        qa_html_theme_base::body_tags();
}

+2 votes
by
reshown by

I added your code in my advanced theme file inside the body_tags() function but it doesn't add the "-edit" class at the end of qa-template-question !!

i also tried this:

if ($this->template === 'question' && qa_request_part(1) === 'edit')

$class .= 'edit-page';

but still nothing !!  What a headache :(

by
EDIT: it worked finally. My mistake, so i selected your answer as the best ;)

YOU RE THE BEST - THANK YOU SO MUCH !!!!
...