I have a scenario where I want 3 levels to show in my main menu, except for one specific level 2 page where I don't want to show its children.

Using hard-coded IDs works fine, eg: {exp:structure:nav start_from="/" show_depth="3" exclude="100|101|102" }

But when I replace the hard coded IDs with the structure tag that generates these IDs, it doesn't work: {exp:structure:nav start_from="/" show_depth="3" exclude="{structure:child_ids_for:14}" }

Anyone have any ideas? I've also tried using snippets and and embedded template and neither work, though a snippet does work when the hard-coded IDs are in the snippet, just not when {structure:child_ids_for:5} is in the snippet.

Here's the code I've tried using embeds:

In the header:
{embed="embeds/main_menu" hideStudentPages="{structure:child_ids_for:14}"}

In the embed:

{exp:structure:nav start_from="/" show_depth="3" include_ul="no" add_level_classes="yes" show_overview="yes" exclude="{embed:hideStudentPages}" }

Thanks in advance, Justin

  • Please see my answer here: expressionengine.stackexchange.com/questions/24104/… – Rob Sanchez Jan 22 '15 at 0:05
  • Sorry Rob, that's not working either in my case, perhaps because I'm using the {structure:child_ids_for:xxx} tag instead of just the {structure:child_ids} tag. I've updated my entry above with the code I've tried using embeds. – JustinXyn Jan 22 '15 at 17:07
  • Are you sure you are getting output from that tag on the embeded template? – Johnathan Waters Jan 22 '15 at 18:22
  • Yes, the output of the tag works just fine - just not inside the {exp:structure:nav} tag. It's very weird! – JustinXyn Jan 22 '15 at 21:09

Why not just use the start_from= tag? Would be a simpler approach than muddying up your templates with embeds.

You'd do something like this for each section:

{exp:structure:nav start_from="/about-us" show_depth='1' max_depth='1' has_children_class='yes' show_overview="yes"}

Configure your options for however you need the HTML markup to be on the front-end.

You can read about that here:

http://buildwithstructure.com/tags#tag_navigation

  • I see where you're coming from, but I need the entire menu to be completely dynamic all the way from the root level, so having to setup a loop for each root level item that generates a child {exp:structure:nav} tag makes it even more complicated than an embed. Plus, I only need this to happen if the users are logged out. The {exp:structure:nav start_from="/" show_depth="3" exclude="{structure:child_ids_for:14}" } is tag is really what I need to get working where the {structure:child_ids_for:14} tag parses before the {exp:structure:nav} tag. – JustinXyn Jan 23 '15 at 16:16
  • i don't know wether it makes a difference, but have you tried {structure:child_ids_for:14 parse='inward'}" – Jelle Dijkstra Nov 25 '16 at 16:13

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.