Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Why aren't custom pages highlighted when open?

+1 vote
116 views
asked Aug 3, 2011 in Q2A Core by NoahY2
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
answered Aug 4, 2011 by NoahY2
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>
                                                </li>

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?
...