Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to keep parent page main menu link current while on child page?
#1
I am not sure I'm wording this correctly, but I have two menu bars on my site: A top level nav bar and a sub page nav bar showing child pages where applicable.

The main menu is made up of individual css sprites and set up manually in css using the .current class.

The child menu is made using Erik's Child Menu Plugin http://www.fohlin.net/getsimple-child-menu-plugin and styled appropriately using the
Code:
#child_menu .current a
css markup.

What I would like to do is have the link to the parent page stay "current" while someone is on that page's children. I'd also like the current state of the child pages to keep functioning properly as well.

I suspect I'm making this sound more complicated than it is, so here is the site I am talking about...

When at http://www.newenglanddrawings.com/drawings/ you will see the current state of the drawings page link is underlined.

If you click any of the sub page links, let's say http://www.newenglanddrawings.com/drawings/pen-and-ink the child page link turns current, but the parent page link is now no longer indicated as current.

How do I bend this to my will to let people know they are in a certain "section" of my site?

I am a total php / functions newbie, so I fear I will need pretty detailed instructions if coding is involved. I'm hoping the solution is easier than I am making it sound.

Thanks for any suggestions.
Reply
#2
You could use the I18N plugin and its navigation instead - then the CSS class for the "active" parent pages is currentpath.
See here (and sub pages) for examples.

P.S.: This is my 1000th post!
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
Dominic Wrote:What I would like to do is have the link to the parent page stay "current" while someone is on that page's children.

Edit your template and change:

Code:
<?php get_navigation(return_page_slug()); ?>

to:

Code:
<?php get_navigation(get_parent(0)==''?return_page_slug():get_parent(0)); ?>
Reply
#4
mvlcek Wrote:P.S.: This is my 1000th post!

Congratulation, Martin!

I love your plugins and your support!

Cheers, Connie
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#5
I did spend a good part of my research for this on the i18n support page but i'm ashamed to say that most of the documentation was a bit over my head. It also seemed that the i18 navigation conflicted with the child menu plugin and wouldn't let me order them correctly. I am going to give Carlos' fix a try first and if that doesn't work I'll probably have more detailed questions.

Thank you both for your help and congrats to mvlcek on your 1000th post! Honored that I was a part of it!
Reply
#6
Carlos Wrote:
Dominic Wrote:What I would like to do is have the link to the parent page stay "current" while someone is on that page's children.

Edit your template and change:

Code:
<?php get_navigation(return_page_slug()); ?>

to:

Code:
<?php get_navigation(get_parent(0)==''?return_page_slug():get_parent(0)); ?>


Carlos, this worked perfectly! And when I remembered to put it in the UL tags I didn't even have to restyle it! Thank you!!!
Reply




Users browsing this thread: 1 Guest(s)