WordPress Custom Menus

I decided I wanted to change how the top menu on this blog was working, so started in my usual manner: look at source code of header.php in the theme and start altering the WordPress calls to wp_list_categories to include or exclude certain categories. My intention was to separate my posts about HTML5 elements into separate menu link so they all appear together, then have Home showing all posts except the HTML5 ones to avoid them overwhelming the rest of the (infrequently posted!) content.

Poking around in the Graphene theme though things weren’t so obvious (no calls to wp_list_categories), so I headed back into the WordPress admin menus and spotted custom menus. This lives in Appearance -> Menus. Enter a name and create a menu – I called mine TopCategory.

After this if the theme supports custom menus you can choose which menu placeholder to use your new menu in place of. Graphene supports three menus and I selected the header menu. From the side panel particular pages, categories, posts etc can be added to the menu and then arranged. I went for Home (in the pages section), About (also in pages) and then the HTML5 category. This then added the menu as I had hoped. Click on the screenshot for a full-size view of this.

WordPress custom menu screen

The final step was to stop the HTML5 posts appearing in Home. A Graphene setting (Graphene options -> General -> Front page options) allowed me to select which categories to show on Home, in my case everything except HTML5.

I need to do some digging to understand how the custom menus hook into the theme so I can add them into themes that I create from scratch, but it has certainly made customising menus a much easier proposition without resorting to hardcoding of particular category ids to be specifically included or excluded.

Leave a Reply

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