Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
869 views
in Q2A Core by
edited by
I have replaced the main navigation menu with the sub navigation menu.

I deleted nav('main'), I just don't need it, I only use nav('sub') in the header.

The problem is however, whenever I click on a question title, I get to a new page with the question contents... but then the sub navigation menu in the header is disappeared.

So, how can I keep the sub-nav menu always visible, and use it as the main navigation in the header?

1 Answer

0 votes
by

The sub-navigation menu is dependent on which page you are on - question pages don't have a sub-navigation menu, and that's why none is shown. It sounds like your custom theme would have to manually build the sub-navigation menu as appropriate, before calling nav('sub')

by
+1
^ I understand, but I would like to know how I can hack the nav('sub') into begin independent from which page you are on, I just want it to be visible all the time, just like nav('main').

Can you give me any advice on how to do that en where to look exactly?
by
You can use the questions sub-navigation on other pages by doing something like this in an advanced theme:

function nav_main_sub()
{
  if (empty($this->content['navigation']['sub'])) {
    require_once QA_INCLUDE_DIR.'qa-app-q-list.php';
    $this->content['navigation']['sub']=qa_qs_sub_navigation('');
  }

  qa_html_theme_base::nav_main_sub();
}

Code not tested so be on the lookout for issues.
by
Thanks! That did work, the subnavigation questions are visible on all pages, but the mainnavigation is visible as well... I just hided that one with css display: none property :-P Thank you for your time!
by
Could you explain please step by step how you hid that? I'm not too familiar with css. :) I finally got the sub-navigation appearing 100% of the time, but like you said, it's appearing on all pages now. Would only like the sub nav to be appearing when I only click on 'Questions'. Thanks!
...