Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
709 views
in Q2A Core by
I want to add some text in the sidebar which should be shown in the sidebar when you click on a particular category only. How can I do this?
Q2A version: 1.5.4

1 Answer

+1 vote
by
edited by
 
Best answer

Ok, as we had the pleasure before with Your question 

http://www.question2answer.org/qa/20735/i-want-to-see-categories-only-on-home-page-how-can-i-do-it

we can go ahead with the modification to achieve that the category description gets printed out in Your sidepanel when You are on a category page.

In admin menu You can add a description to each category, I think it is up to 1000 characters. The way I am using here is the best I found, it still may be that there are better ways to solve it, but this is the best I can offer for now.

Now please modify and add the sidepanel function in Your qa-theme.php as follows just before the closing }

 

function sidepanel()
        {
            $this->output('<DIV CLASS="qa-sidepanel">');
            $this->widgets('side', 'top');
            $this->sidebar();
            $this->widgets('side', 'high');
            if (qa_request_part(0)==''){
            $this->nav('cat', 1);
            }else{
if ( (isset($this->content['categoryids'])) && (!empty($this->content['categoryids']))  && ($this->template=='qa')){
$mycategoryid = end($this->content['categoryids']);
$mycatgeorycontentholen = qa_db_query_sub("SELECT content FROM ^categories WHERE categoryid =  '$mycategoryid' ");
$mycatgeorycontent = qa_db_read_one_value($mycatgeorycontentholen,true);
$this->output($mycatgeorycontent);
}
}
            $this->widgets('side', 'low');
            $this->output_raw(@$this->content['sidepanel']);
            $this->feed();
            $this->widgets('side', 'bottom');
            $this->output('</DIV>', '');
        }
 
That should do it. New readers please read the question mentioned above as well.
 
 
Further reading:
...