Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
11.7k views
in Q2A Core by
As far as I can see, the categories in the sidebar are only shown on certain pages (Questions, Unanswered). How can I show them on all pages? I'm using a customized theme. Thanks

2 Answers

0 votes
by
 
Best answer
Use an advanced theme to override the sidepanel(...) function. In your version, check if $this->content['navigation']['cat'] is empty. If so it means that a category list hasn't been passed through to the theme, and you need to create one. In that case you want to set it up as follows:

global $qa_db;

$categories=qa_db_single_select($qa_db, qa_db_categories_selectspec());

$this->content['navigation']['cat']=qa_category_navigation($categories);

Then your overriding function should call the default sidepanel(...) one as usual.
by
I have put:
_______________________

global $qa_db;

$categories=qa_db_single_select($qa_db, qa_db_categories_selectspec());

$this->content['navigation']['cat']=qa_category_navigation($categories);

_______________________


Just before $this->sidepanel() in the function body_content().

But it gives me an error:

Warning: Invalid argument supplied for foreach() in /home/public_html/qa-include/qa-db.php on line 356

Question2Answer query failed:

SELEC

Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELEC' at line 1
by
Sorry, yes, the $qa_db parameter is also no longer needed (you can remove the global declaration too).
by
I have put:
___________________

$categories=qa_db_single_select(qa_db_category_nav_selectspec(null, true));

$this->content['navigation']['cat']=qa_category_navigation($categories);

_________________

Just before $this->sidepanel();

And it worked now. Thank you gidgreen!
by
can i use this codes for snow theme?
i want't to show categories in sidepanel at all pages.
0 votes
by
...