Conditional Menu Modules based on referrer

I’m building a website for a hospital, and the site has quite a large number of sections, each of which has many subpages. Each section has its own menu that appears in the sidebar—which is not technically a sidebar, but a BB-template-defined column on the Page Builder layout. So every page in the “About Us” section, for example, has a side menu of all the pages in that one section.

Some sections share pages: for example, the page “Letter from the President” might appear in both the “About Us” section and the “Patients and Visitors” sections. The client would like the appropriate menu to appear on those pages based on which section the user is visiting. In other words if they are in the “About Us” section and click the “Letter to the President” menu link, the page will the show the “About Us” menu. BUT if they are in “Patients and Visitors” and click the link in THAT menu, the “Letter to the President” page will show the Patients and Visitors section menu.

I hope I’m explaining it clearly: basically he situation is that several pages that need to appear in more than one section, but display the side menu of the section is currently in (based on the link they clicked to get to that page).

I’m wondering if anyone has a suggestion on the best, most appropriate way to do this. Obviously I would rather NOT create duplicate pages where the only difference is the side menu.

Hey Jose,

The most appropriate way to do this would be to custom code the menu part. Take a look at the is_page() conditional tag, there are few snippets there on the bottom which allow you to check if the page is a subpage of a certain parent page.

Also, if you haven’t yet, feel free to ask this same question over to the BB FB Group and/or Slack Channel. The guys there might have other suggestions. :slight_smile:

Hope this helps!

Ben