Main Menu to show only parent pages and not all of them

Hi,

I'd really love to be able to fully customize my menu(s). For example, my site (http://crowneurope.eu/) is currently showing all pages in the main menu. Instead, I would prefer to be able to determine which pages show up in the menu. In addition, I would like some of the child pages to not show up as sub-menu items at all.

How can I do that?

Thank you very much!

Andrew

  • Philip John

    Hey Andrew!

    Thanks for joining WPMU DEV, it's great to have you here!

    At the moment, this theme doesn't support the standard WordPress Menus feature but you can achieve your desired outcome with a small bit of code customisation...

    Find your way to the theme files in /wp-content/themes/bp-scholar and open up header.php in a text editor.

    Find line 212 which should look like this;
    <?php wp_list_pages('title_li='); ?>

    Edit that to look like this;
    <?php wp_list_pages('title_li=<strong>&exclude=1,4,38</strong>'); ?>

    You should replace "1,4,28" with the ID numbers of any pages you don't want to appear in the menu.

    Or you could specify which pages should be included like so;
    <?php wp_list_pages('title_li=<strong>&include=1,4,38</strong>'); ?>

    You can prevent child pages appearing by adding an extra piece, like so;
    <?php wp_list_pages('title_li=&exclude=1,4,38<strong>&depth=1</strong>'); ?>

    That will tell WordPress to only show the first level (i.e. parent pages).

    Hope that helps :slight_smile:

    Phil

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.