Hello, I would like to display specific pages in the left sidebar of my page which is working. in the right sidebar I would like to display only the sub pages of the current page. Is this possible?
Thanks, Frank
We use cookies to allow login, checkout, and analyze site traffic. By continuing to use this website, you consent to the use of cookies in accordance with our cookie policy.
OnPoint Plugins
Hi Frank,
If you add the following filter to your active theme’s function.php file the menu will display the current page’s children only.
If you wish to also include the current page you may use the “Display highest level parent page” option. Leaving this option unchecked will not display the current page.
Have a great day!
Frank Neuhaus
Hi, thank you very much, this is great.
But I would like to keep the “normal” menu in the left sidebar and show only the submenu items in right sidebar.
Is this possible somehow?
Thanks again, Frank
OnPoint Plugins
Hi Frank,
You may target a specific sidebar or widget id by changing the filter to the following:
SIDEBAR_ID_GOES_HERE
to the id of the sidebar.WIDGET_ID_GOES_HERE
to the id of the widget.id
).Frank Neuhaus
Hi, thanks again.
I have sended credentials so if you could take a look it would be great.
Frank
OnPoint Plugins
Hi Frank,
It’s a bit tricky to determine the ids because this is an Elementor widget, but give the following a try:
Let me know if it doesn’t work and I’ll spin up an environment with Elementor loaded to see if there is anything unique we can use to target the widget.
Frank Neuhaus
Hi, this worked partially.
When I open a page including a parent item it is working fine and show only the child items within the left sidebar.
When I open a subpage the child items are gone.
You might want to look here
https://www.viacarta.eu/horoskope/50-plus-horoskop/
and here
https://www.viacarta.eu/horoskope/50-plus-horoskop/50-plus-horoskop-widder/
Thanks, Frank
OnPoint Plugins
Hi Frank,
Do the sub pages have children?
The filter as written will only show child pages of the current page. If you are on a page which does not have children, there is nothing to display.
Frank Neuhaus
No, there are no children on subpages so I was hoping the code will reference to the parent item of the current subpage.
OnPoint Plugins
Hi Frank,
A little creative engineering and the filter can be made to display the current page’s level when the current page has no children:
Frank Neuhaus
You are great!!! It is working. 🙂
Thank you so much for this outstanding support.
Frank