Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to keep parent page main menu link current while on child page?
Author Message
Dominic Offline
Junior Member

Posts: 41
Joined: Jan 2012
2012-02-01 15:05:18
How to keep parent page main menu link current while on child page?
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.
Visit this user's website Find all posts by this user Quote this message in a reply
mvlcek Offline
Posting Freak

Posts: 1,764
Joined: Jan 2011
2012-02-01 16:38:03
How to keep parent page main menu link current while on child page?
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.
(This post was last modified: 2012-02-01 16:39:25 by nime.)
Visit this user's website Find all posts by this user Quote this message in a reply
Carlos Offline
GS Freak

Posts: 1,421
Joined: Mar 2010
2012-02-01 18:35:49
How to keep parent page main menu link current while on child page?
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)); ?>

- News Manager 2.4.3 + additional plugins
- Some other GS plugins
Visit this user's website Find all posts by this user Quote this message in a reply
Connie Offline
Super Moderator

Posts: 2,722
Joined: Feb 2011
2012-02-01 19:20:21
How to keep parent page main menu link current while on child page?
mvlcek wrote:P.S.: This is my 1000th post!

Congratulation, Martin!

I love your plugins and your support!

Cheers, Connie

|--
Die deutsche GetSimple-Webseite: http://www.Get-Simple.de = the german Get-Simple-Website!
Das deutschsprachige GetSimple-(Unter-)Forum: http://get-simple.info/forums/forumdisplay.php?fid=18
Find all posts by this user Quote this message in a reply
Dominic Offline
Junior Member

Posts: 41
Joined: Jan 2012
2012-02-01 23:18:34
How to keep parent page main menu link current while on child page?
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!
Visit this user's website Find all posts by this user Quote this message in a reply
Dominic Offline
Junior Member

Posts: 41
Joined: Jan 2012
2012-02-02 02:11:03
How to keep parent page main menu link current while on child page?
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!!!
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)

Contact Us | GetSimple | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication
Generate Leads from Documents vCard Hosting