WordPress Blog: Exclude a Page from Navigation

WordPress Blog: Exclude a Page from Navigation

If your WordPress blog offers drop-down menus, chances are you have pages/links that are appearing in those sub-menus that you may want to hide from the main navigation.

The solution is quite simple:

Open ‘header.php’ file from your themes directory.  Make sure you open the theme that is currently in use with your blog/website!

Find the code below, which should be approximately 3/4 the way down the page.

<?php wp_list_pages('sort_column=menu_order&depth=1&title_li=&exclude=30,47,68,102,113'); ?>

Add the string in green/bold as you see above to your code.

The bold exclude parameter has numbers that trail it. These numbers, represent your pages. Simply add the page number to the exclude parameter, save, upload your file and your sub-links will be excluded from your main navigation.

Note: numbers being used in this example, are exactly that, an example. Remove the numbers that do not pertain to your website.

Share the Post

About the Author

Comments

Comments are closed.

Your Name (required)

Your Email (required)

Your Message


Please leave this field empty.

Cart

  • No products in the cart.

Login