Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
in Q2A Core by
I can't find the code to set custom pages as selected in the main nav bar.  The result is my custom page link in `qa-nav-main-list` is not highlighted when a user navigates to the page.  Am I doing something wrong?

1 Answer

0 votes
Well, I figured out a hack-around for it anyway... a wrinkle is that the nav class isn't named by the page slug as it probably should be... instead it's given as "qa-nav-main-custom-#" where # is the number of the custom page in the admin.  The hack was to add the following to my page's page template:

$qa_content['navigation']['main']['custom-2']['selected'] = true;

(my page is the second custom page, I guess)

This gives the following code for the Badges page:

<li class="qa-nav-main-item qa-nav-main-custom-2">
                                                    <a class="qa-nav-main-link qa-nav-main-selected" href="./badges">Badges</a>

and voila, the nav item is selected :)

Hopefully I can dig deeper and find out where to add a check to the main code, or at least change the "custom-2" to "badges" so I can just write a command for it, but maybe Gideon can help?