Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
325 views
in Q2A Core by

I am trying to create a plugin to remove the category list of the sidepanel.

This is equivalent to remove this line: https://github.com/q2a/question2answer/blob/29cce8d2c5e3943a2d3242adf6f15217a6096b20/qa-theme/SnowFlat/qa-theme.php#L334

I am trying this (note that I tried three different possibilities):

class qa_html_theme_layer extends qa_html_theme_base {
        function initialize(){
                unset($this->content['sidepanel']['nav']['cat']);
         //       unset($this->content['sidepanel']['nav-cat']);
              //      unset($this->nav('cat',1)); // This one seems to be an error
        parent::initialize();
        }
}

How do I find the information about the item I want to remove? This seems very difficult for me (I am very sorry if this is a stupid question)! What I can see in my browser is:

a) qa-template-qa seems to be the main class;

b) I have also the class "qa-sidepanel"

c) After this I have "qa-nav-cat"

Is there a more clever way to find the names of these items?

Q2A version: 1.7.0

1 Answer

+2 votes
by
selected by
 
Best answer

Override layer function (doctype/html/body/body_content/nav) in your layer module.

Example-1:

function doctype() {
    if(isset($this->content['navigation']['cat']))
        unset($this->content['navigation']['cat']);
    qa_html_theme_base::doctype();
}

Example-2:

function nav($navtype, $level=null) {
    if($navtype == 'cat')
        return;
    qa_html_theme_base::nav($navtype, $level);
}

by
How did you find out that I should unset "content['navigation']['cat']"?
...