Jump to content
hugo2808

Keep Main Nav Item highlighted after change page

Recommended Posts

hugo2808

Hi all!

I'm building a site with a main nav with single items (no dropdown)

 

Consider my nav menu

HOME   EVENTS

 

In EVENTS page, I enter in it and the item events is highlighted, everything OK.

In this page I have a sidebar Menu with a list of events, so my most recent event is the page used in the nav menu for EVENTS item, I mean, when I click on menu item EVENTS i got to the page of my last event!

 

When I change event in the side bar menu, I go to another event page but I would like to keep the EVENTS item of main nav highlighted (has if I hadn't changed page)

 

Is it possible?

 

Thanks

 

Hugo

Share this post


Link to post
Share on other sites
catrina

You’ll need to use Custom CSS (in Site Options > Custom Code > Custom CSS/LESS). To find the Custom CSS you need, you'll need to use Firebug (or Chrome Development tools). To learn how to use Firebug for CSS customizations, please review this entire documentation and follow the instructions: http://support.pagelines.me/docs/customization/custom-css. For help with the link attribute, please see these instructions: http://www.w3schools.com/css/css_link.asp. To be more specific, you need to use the <li> class .current_page_item in your CSS selector so that your CSS change is applied to the current/active page link.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
hugo2808

Hi, thanks for your help.

I was trying to do it on style.css of Customize Plugin.

So changes must be done in the Framework directly has you said!

The problem is that I really change page when I click on one item in my side bar menu, and I cannot make reference to the item of my nav bar in order to don't loose highlight.

 

Thanks

 

Hugo

Share this post


Link to post
Share on other sites
Danny

Hi Hugo,

 

So if I understand you correctly, you have created a menu item called events, is this a page/post/category or a custom post type ?


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
hugo2808

Hi Danny,

I've created a item in the main nav called EVENTS that is a page.

This page is the last event I have (chronologically)!

 

When I enter in the page (called by the main nav item EVENTS) I have a side bar menu with all the events I have.

Off course the main nav EVENTS is highlighted because I'm in his page, but when I choose another event from side bar menu and change event I loose the main nav item EVENTS highlight because I change page.

I would like to have the main EVENTS highlighted in all my events pages, and not only in the one that references the main menu item EVENTS.

 

I can put all other events pages has child's of my reference page, but I can't still block the main nav for highlight.

 

Thanks

 

Hugo

Share this post


Link to post
Share on other sites
Danny

OK, if other events from the sidebar menu are also pages, make these pages child pages of the events page, this should resolve the issue.

 

Also, would it be possible for you to provide a link to the site in question please.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
hugo2808

I still don't have it online, soon will!

Child pages are not in the main nav, shall I put the there?

 

Or is any css to reference the parent page?

 

Where should I put the css, in the stule.css of customize pluging, or in the Site Options > Custom Code?

 

Thanks

Share this post


Link to post
Share on other sites
James B

Hi there,

 

Yes, following what Danny said if you put the child pages into the nav this should resolve the problem for you.

 

You can also set the active state of a menu item using css within a sidebar menu item or within the main nav. You can place that css into the style.css of the customize plugin if that's what you're using, it will still work.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
hugo2808

Hi,

I've putted all the events pages has child of my reference page in main nav menu, and I configured the css for .main-nav .current-page-ancestor a  and now I have the expected result, all event pages highlight the EVENTS menu item.

 

This is possible not the best solution, but it works!!

 

Thanks all 

Share this post


Link to post
Share on other sites
James B

If it works that's all good :-)

 

Glad you got it working.


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
hugo2808

Now I'm facing a second issue in the same problem.

The pages of the side bar menu have post loops inside, and when I enter in a single post the menu looses highlight.

I've seen that is because the reference from a post to a page is not native!

Is there any possible way to do it, highlight a menu item from a post?

 

Thanks for your precious help!!

 

Hugo Dias

Share this post


Link to post
Share on other sites
Danny

Hi Hugo,

 

If the post is configured in the menu as a child item for your page, then it should work like this:

http://d.pr/i/qAPp

On the image above, the Sample Page menu item has the Test Post 3 post set like this, in the Wordpress Custom Menu.

 

Sample Page
    Test Post 3

So it should work automatically.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
hugo2808

Hi,

the post isn't configured in the menu!

I would like to make something like: "highlight a menu item if the post page displayed is from a certain category"!

 

Is it possible??

 

Thanks

 

Hugo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • Michael Kummer
      By Michael Kummer+
      Hi guys!
      I have noticed that my primary sidebar becomes intermittently invisible when browsing through various blog articles on michaelkummer.com/blog.
      See:
      https://www.dropbox.com/s/z646sgoa3mfjl1j/Screenshot 2018-07-12 15.57.46.jpg?dl=0 and https://www.dropbox.com/s/vdledzzgginvwgv/Screenshot 2018-07-12 15.57.57.jpg?dl=0
      Upon refresh, the sidebar appears. I have been using the following CSS code to hide the sidebar on mobile without any issues. 
      @media only screen and (max-width: 993px) {
      /* hide sidebars */
           .plsb {
              display: none !important;
          }
      }
      I tried to add the following CSS to force the sidebar to show on screens that are wider than 994 pixels but to no avail. Any clue what could be causing this issue?
    • Liv Kundalini
      By Liv Kundalini+
      Hi -
      Pulling my hair out over here, and would love an assist!
      Site I am building, http://www.livkundalini.com/home, has a problem with the submenu items in the nav not appearing. 
      If anyone wants to see what the Nav should look like, feel free to look in the footer on the left hand side.
      Have tried disabling Pagelines and using the twentyseventeen theme, but problem persists.
      Saw this error (pasted at the bottom of this post) displaying in the inspector, and saw discussion of Jetpack potentially being a culprit. Disabled Jetpack, but the problem persists.
      Had the hosting company even flush the server-side cache, but no avail.
      Any thoughts? Please? It's the only thing keeping me from launching this site!
      Many Thanks,
      Todd
       
      WebSocket connection to 'wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data' failed: Error during WebSocket handshake: Unexpected response code: 403   O @ (index):7
    • russe-intensif
      By russe-intensif+
      Hi team,
      checking my site today, i'm surprised to see my MegaNav all in bottom of the pages, while it's in header.
      After getting to change it in couple of pages onto Template part (too time consuming !), i'm desperate and ask you for help :-)
      apprendre-le-russe-avec-ania.fr
      Thank you in advance !

    • dwpoyner
      By dwpoyner+
      Not sure exactly what is causing the issue. For some reason, why you view my site on mobile, the menu does not show up. It will pop up, but it is black. You can check it out here: http://dev.caryfbc.org. I'm also attaching a screenshot where I shrunk my browser down. Any suggestions?

    • Anthony CALCI
      By Anthony CALCI+
      Hello,
      I have switched from the Framwork theme to DMS theme on http://calcipatrimoine.theproofingcompany.fr (miror site of http://calci-patrimoine.com).
      But I have now only the Primary sidebar in the Widget section ! Secondary sidear, Footer sidebar have all disapear...
      Can I have help to have them back ?
      Regards,
      Anthony
×