Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

Showing content from another page when I click on a parent link

Started by Mohamad Ghazal 9 years ago · 2 replies · 715 views
9 years ago

Hi Guys;
Let's say I have this page structure:

I want to have the parent menu name appear on the nav, but when I click on it the default content comes from the Child 1. This is my menu structure:

TXT
First level >  Parent 1 > Parent 2 > Parent 3 > Parent 4
Second level  > Child 1 > Child 2 > Child 3 > Child 4 (all of second level belong to Parent 3)
third level > Grandchild 1 > Grandchild 2 (These could be 2, 3 or 4, depends on the content of the Child)

Now, if I click on Parent 3, I will see all of my second level menu, but then, if I click on the, let's say, Child 2, the third menu for that child would show BUT the content of the first grandchild would show, Child 2 itseld does not have content, but I need it on the menu so that I can create a visual cue of the selections.

How do I automatically display the content of Grandchild 1 when I click on Child 2 without having an empty page show first and then I having to select the Grandchild 1.

Not sure if it's clear 🙂
Thanks!

9 years ago

I am a little confused here, are you talking about menu behaviour or having content form one page into another?

  1. For the menu: That will depends on how your template handles the menu in twig.
    See this site I am using Helium theme, I have the Services & Techniques menu item as routable: false in page header. In that way the theme does not render a link for that menu item, just behavies like a drop down on hover, showing child items links.

  2. If you are talking about showing content form other pages, you could create a new twig template to show child pages content, or you could use the page-inject plugin.

👍 2
9 years ago

shoot!...I'm gonna need both of your suggestions!
awesome!...thanks @hugoaf!

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by Pedro M, 2 months ago
4 193 2 months ago
Themes & Styling · by Ian, 2 months ago
3 90 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 449 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 43 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 123 3 months ago