Recently, I worked on a client project where we needed to create a distraction-free landing page. The goal was to maximise conversions by focusing the visitor’s attention solely on the call-to-action. To achieve this, I needed to hide the navigation menu on this specific page while keeping it visible throughout the rest of the site.
This project led me to develop a handy code snippet for conditionally hiding the navigation menu in GeneratePress. Today, I want to share this solution with you, as it’s a technique that can be incredibly useful for creating focused landing pages or customizing the user experience on specific parts of your WordPress site.
The Code
Add the code below to functions.php
or code snippet plugin.