I have a site that is in two distinct halves. I’d like the same template to apply to the whole site (from a look & feel perspective), but for each ‘half’ of the site to have its own top nav menu. No side menus are in use.
The home page is going to be a custom page that directs the user to one or other of the two sides.
How might I go about achieving this?
Many thanks
Austen
The easiest solution would be to set a cookie. Then check what cookie the user have before you print the menu.
Another solution would be to add a query variable so that the two halves have different urls, for example mysite.com/?half=A and mysite.com/?half=B. Then you check the query var before you print the menu. This solution would make it possible with permalinks for the two different halves. (and you can make the urls pretty if you want)
Use a custom menu with
wp_nav_menu()
. Then check whether you’re on part one or part two:I believe the simplest solution would be to create two nav menus in the WordPress backend, then load different headers based upon the page the visitor is on.
Start by copying your header.php 2 times, giving your three header files. Example: header.php, headerA.php, headerB.php
Now, open you original header.php and replace all the code with something like this:
This will tell Wordress which header to load, based on the type of page the visitor is on.
Also, make sure you load the correct menu in each header file using: