Archived topic
How to control visibility of the secondary menu
3 replies · Started by Mark Christen on December 11, 2021
Hey there,
I'm using the secondary menu with post categories. My goal is to display the categories as a menu just in two places:
1. the defined posts page (as set in the WP settings area)
2. on the categories archive page
To achieve this I've tried to adopt your code on https://docs.generatepress.com/article/show-secondary-navigation-to-logged-in-users-only/
to meet my requirement.
The problem is that I can't identify the posts page and the categories list page with a WP function.
Do you have a solution for my problem?
Thank you in advance.
Best,
Viktor
Hi there,
you can use the Layout Element:
https://docs.generatepress.com/article/layout-element-overview/
Select the Disable > Secondary Nav.
Set the Display Rules > Location to Entire Site
Set the Display Rules > Exclusions to: Front Page and Category Archives
Hi David,
Thank you very much. I've tried to use the Layout Element feature. It helped to meet my two requirements.
The secondary menu containing the categories shows up on the category page and on the posts page only.
The settings I needed for this are as follows:
Disable Elements -> Secondary Nav
Display Rules -> Location = Entire Site
Display Rules -> Exclude = Blog, Exclude = Post Category Archive
Thank you for your support.
Glad to hear you got that working!!