This PHP code enables you to add the primary nav menu class if the primary navigation is being used in the primary nav menu location and the user is logged in.
The benefit of using this code is that you can remove the markup which is needed for the primary nav menu when using a nav menu which is only displayed for logged in members.
This enables you to remove any gaps or spaces the menu adds when not used.
The code works in any theme and can be easily modified to work for logged out users, in other menu locations or with different conditional tags.
Leave a Reply