
Show the parent in sub-navigation with Structure
Structure by Travis Schmeisser is an incredibly powerful plugin, but the navigation tag does have limitations. We share a snippet of code to allow the parent to appear within a sub-ul on a navigation.
What the problem is
Structure's own nav tag builds a really nice unordered list of the pages on your structure. Like so...
However with drop-down navigation it is often a better user-experience to add the parent to the top of the sub-ul/dropdown. Why? Simply because some users don't know they can click the top link and miss the page altogether.
The Solution?
Let's just add one!
Requirements
Other than Structure, you'll need Peter Lewis' free "Structure Entries" plugin which is available from Devot-ee. At the time of writing, you need to download a beta version of the software from here
The Magic Code
Simply add the following code (full disclosure, this is unsupported and rather basic - you may need to tweak for your site) in place of Structure's standard nav tag
What do you think? Can you improve upon it or need a hand? Post in the comments below...
- by Andie Fairlie
View more posts Tweet this Random post