Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
in Q2A Core by
I'm creating a page plugin to import questions to Q&A and I would like to link that page in the admin sub-menu. It is not in the options offered in the pages configuration so I was wondering what was the best way to do that.  I though about adding in in my qa-theme in the function nav($navtype), but I'm not sure on how to recognize the admin sub-menu versu any other menu that could exist.


1 Answer

+1 vote
Best answer

You could do it in qa_admin_sub_navigation() in qa-app-admin.php but then you'll need to apply the change to future Q2A versions. Otherwise, doing it through nav() in the theme is also OK - $navtype will be 'sub' and you should also check $this->request in your function to see if you're on an admin page.

Thanks, this worked fine... I don't know why I didn't think about checking the request to figure out if I'm on the appropriate page...! I decided to add my link in the theme since I already have enough files to merge with new versions of Q2A ;) The only minor issue is that Q2A looses its context once my link is clicked (ie the admin menu isn't selected anymore so the sub menu isn't shown either). I've noticed that even if I put my link in the main menu via the admin panel, it isn't shown as selected either...