How to exclude pages from wordpress menu without plugin

Sponsors

css-menu-sampleIn this tutorial I will show you how to exclude the pages in menu.

Normally when we are creating wordpress theme for showing the pages we code as follows

<?php wp_page_menu(‘show_home=1&menu_class=page-navi&sort_column=menu_order’); ?>

As per this code all pages will get displayed in menu. For showing selected pages check the page id.

and then use following code.

<?php wp_page_menu(‘show_home=1&exclude=5,9,23&menu_class=page-navi&sort_column=menu_order’); ?>

You are able to see the I added the exclude parameter in wordpress method.
Your selected page id for excluding from menu, you need to just put there with commma sepreated.

Put this code in your header.php file for shoing the menu. You are able to exclude the pages from wordpress menu

Incoming search terms:

You may like following Articles!

This entry was posted in wordpress, wordpress api and tagged , by Wordpress API. Bookmark the permalink.

About Wordpress API

API means Application Program interface. In Wordpress API we are giving all the information about wordpress API. We worked for many wordpress plugins and themes. We have expertise in PHP, Databases, Graphic Design, Ruby on Rails, Java, Wordpress, Drupal and many CMS. We always give you the best solutions about wordpress and other related topics in This Blog. We will give you always fresh tips and tricks and techniques about wordpress in this blog.

7 thoughts on “How to exclude pages from wordpress menu without plugin

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>