Limit the Number of Pages in Your WordPress Navigation Bar

We will show you how to make specific pages show up in your navigation Structure.

Using the “include” function in WordPress you can specify the exact number of pages you want to show in your navigation.

Note -There are plugins which will order the pages for you, but I have not found any plugins which will limit the number of pages showing. Also page order plugins can slow down your page load.

Example: Show traffic is gold.
You need to edit the header.php file found here:
wp-content/themes/your-theme/header.php

Open the file with your favorite editor.
Search the file for “wp_list_pages”

The default should look like this:

Change to this

Upload the file and your site should only show the pages you’ve indicated.

About Josh

Comments

  1. Thank you for publishing this! I have needed a solution to this issue for a while. We were not naming pages to keep them off of the nav bar. Actually they were still on the nav bar, but you couldn't see them since they didn't have names. Your solution is the right way to do this.

  2. Jon, glad I could help. If you have any other WordPress issues, let me know I may be able to help.

  3. Jon, glad I could help. If you have any other WordPress issues, let me know I may be able to help.

Speak Your Mind

*