my site has 4 main sections (primary links) "about us, services, community, learn"
within each of those sections there is a sub-navigation (secondary links) of 4-5 pages each.
I need to be able to add a css class somewhere (body, or on the secondary UL) so that I can control the position of each primary section's sub-navigation.
So for "About Us", I want the sub-navigation to have margin-left:0;
For "Services", I want the sub-navigation to have margin-left:150px;
For "Community", I want the sub-navigation to have margin-left:300px;
ect...
I found a few snippets, but they all seem to be to specific(down to the individual page), or too generic("content").
I found a few things indicating this could easily be done with taxonomy, but this is a very simple site that will have multiple editors. I dont' have taxonomy setup because I don't want to rely on other people choosing the right taxonomy term for the appropriate section.
Also - I'm using the genesis base theme if that helps.
Hope my question makes sense.
Comments
did you solve this?
don't know genesis theme, but if you install nice-menus module and use that, you will have many id and class options to work with.
bit of a project getting nice menus styled initially to match your theme, but it's a great menu module once you do.
if you do go forward with it, when you start themeing, basically easiest thing to do is to largely override the module CSS in your own theme style sheet. i think they are working on a way to separate out the look & feel styling, but last I looked that wasn't done.
90% there!
Thanks for the reply! I think this might work... I'm using the blocks that nice-menu generates for each of my 4 sub-menus. But, the configuration is setup to show on all pages. For example... I only want the sub-nav for "community" to show up on the pages that are within the Community section. How can I tell it to only show up on the pages within one section of my primary menu?
I want just the sub-nav to be displayed (all the time, not as a fly-out) on only the pages for that section.
Also - I tried the standard method of replacing the links code in the page template... I tried to edit the css so that they don't fly out... and are displayed as static items, but then I run into the same issue of all the sub-nav menu's showing up on all pages...
functionally, it's working the way I want it to with just the standard menu module. I just want to move the sub-menu's directly underneith the primary menu. Visual might explain a lot: http://www.lightonthemountains-boise.com
...
I see what you are saying, but don't know the answer unfortunately.
I looked at the existing code that you have and, as you already know, nothing there to grab onto.
this might work...
just saw this thread after yours and it seems to be about the same issue.
he cites a module which could do the trick for you.
http://drupal.org/node/593042
...
If you changed your path alias's so that not all sections were the same, eg "/content/" you would get proper sections classes in the body tag.
Having them defined would be better for SEO and your IA in general, so for example if you had...
/about/what-we-believe
/about/our-vision
Genesis would print a body class .section-about, so thats your hook (and incidentally why its there, most sites would break site section with the first arg in the URL).
You can do this with Pathauto or just the path module and write them yourself manually if your site is quite small.
Responsive Drupal Themes | Drupal 8 Design Initiative | Certified to Rock
it works, but....
So I tried hard-coding one of the pages with a different section to replace /content/. It worked! Perfecto... but:
Two small issues:
1 - there is a little bug I found with automatic alias... if you change it from the default, save, then go back and edit, and save - it reverts back to automatic alias.
2 - I want to make this a little simpler for my client who will be creating and editing... so I went into the pathauto settings and found where this is set
Default path pattern:
content/[title-raw]
Is there a variable that I can grab that will pull the parent menu item?
Something like -- [parent-menu]/[title-raw]
got it! thank you thank you thank you!!!
[menupath-raw]/[title-raw]
or actually you only need [menupath-raw]