Custom Menu Support for WordPress Themes

Preview:

DESCRIPTION

Adding Support for WordPress Custom Navigation Menus to your WordPress Theme.

Citation preview

Adding Feature Support

When a backend component exists the process begins in functions.php

Register SidebarsAs seen in most modern themes

Register Menusregister_nav_menu( 'primary-menu', __( 'Primary

Menu' ) );

Enable Custom Backgroundadd_custom_background();

Template Tags Used for Navigation

wp_list_categories();http://codex.wordpress.org/Template_Tags/wp_list_categories

wp_list_pages();http://codex.wordpress.org/Template_Tags/wp_list_pages

wp_nav_menu();http://codex.wordpress.org/Function_Reference/wp_nav_menu

Functions used for Custom Menus

wp_nav_menu();Template Tag to Insert Menu into

Theme register_nav_menu();

Register a single menu location. register_nav_menus();

Register more than one menu locations

Original Code – Categories

<div id="catnav">

<ul id="nav">

<?php

wp_list_categories('orderby=name&title_li='); ?>

</ul>

</div>

Register Menu Location

//Register Navigation Menus

if (function_exists('register_nav_menus')) :

register_nav_menus(array('topmenu' => __('Top Menu'),'catnav' => __('Cat Nav')

));

endif;

Custom Navigation Version

<div id="catnav"><div id="nav"><?phpwp_nav_menu( array(

'theme_location' => 'catnav' ) ); ?></div></div><!-- /catnav -->