How to Conditionally Hide the Navigation Menu in GeneratePress

tdrayson

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.

Members content only

Become a snippetclub.com member to gain instant access to this tutorial plus tons more premium content.

Already a member? Log in below.

Login Form

👋🏻 Weekly Tutorial Digest

I send out a weekly newsletter with links to new tutorials written in the last week, you can subscribe below.

Newsletter

🔒I won't send you spam, I promise