WordCamp Chicago 2010 Custom Navigation Menus: You know you want them. Daisy Olsen http://wpmama.com Twitter: @DaisyOlsen
Template Tags <ul><li>A PHP function defined in the WordPress core designed to add dynamic elements & content to your them...
Adding Feature Support <ul><li>When a backend component exists the process begins in functions.php </li></ul><ul><li>Regis...
Template Tag Parameters <ul><li>Instructions given to the function </li></ul><ul><li>Most template tags have parameters </...
Template Tags Used for Navigation <ul><li>wp_list_categories(); http://codex.wordpress.org/Template_Tags/wp_list_categorie...
Functions used for Custom Menus <ul><li>wp_nav_menu(); Template Tag to Insert Menu into Theme </li></ul><ul><li>register_n...
Original Code – Categories <ul><li><div id=&quot;catnav&quot;> </li></ul><ul><li><ul id=&quot;nav&quot;> </li></ul><ul><li...
Register Menu Location  <ul><li>//Register Navigation Menus </li></ul><ul><li>if (function_exists('register_nav_menus')) :...
Custom Navigation Version <ul><li><div id=&quot;catnav&quot;> <div id=&quot;nav&quot;> <?php wp_nav_menu( array(  'theme_l...
Upcoming SlideShare
Loading in …5
×

Custom Menu Support for WordPress Themes

4,780
-1

Published on

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

Published in: Technology, Business
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,780
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
30
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Custom Menu Support for WordPress Themes

  1. 1. WordCamp Chicago 2010 Custom Navigation Menus: You know you want them. Daisy Olsen http://wpmama.com Twitter: @DaisyOlsen
  2. 2. Template Tags <ul><li>A PHP function defined in the WordPress core designed to add dynamic elements & content to your theme </li></ul><ul><ul><li>wp_list_pages(); </li></ul></ul><ul><ul><li>wp_list_categories(); </li></ul></ul><ul><ul><li>the_content(); </li></ul></ul><ul><ul><li>the_excerpt(); </li></ul></ul><ul><li>http://codex.wordpress.org/Template_Tags </li></ul>
  3. 3. Adding Feature Support <ul><li>When a backend component exists the process begins in functions.php </li></ul><ul><li>Register Sidebars As seen in most modern themes </li></ul><ul><li>Register Menus register_nav_menu( 'primary-menu', __( 'Primary Menu' ) ); </li></ul><ul><li>Enable Custom Background add_custom_background(); </li></ul>
  4. 4. Template Tag Parameters <ul><li>Instructions given to the function </li></ul><ul><li>Most template tags have parameters </li></ul><ul><li>Codex page for the template tag is the best way to see what parameters are available </li></ul>
  5. 5. Template Tags Used for Navigation <ul><li>wp_list_categories(); http://codex.wordpress.org/Template_Tags/wp_list_categories </li></ul><ul><li>wp_list_pages(); http://codex.wordpress.org/Template_Tags/wp_list_pages </li></ul><ul><li>wp_nav_menu(); http://codex.wordpress.org/Function_Reference/wp_nav_menu </li></ul>
  6. 6. Functions used for Custom Menus <ul><li>wp_nav_menu(); Template Tag to Insert Menu into Theme </li></ul><ul><li>register_nav_menu(); Register a single menu location. </li></ul><ul><li>register_nav_menus(); Register more than one menu locations </li></ul>
  7. 7. Original Code – Categories <ul><li><div id=&quot;catnav&quot;> </li></ul><ul><li><ul id=&quot;nav&quot;> </li></ul><ul><li><?php wp_list_categories('orderby=name&title_li='); ?> </li></ul><ul><li></ul> </li></ul><ul><li></div> </li></ul>
  8. 8. Register Menu Location <ul><li>//Register Navigation Menus </li></ul><ul><li>if (function_exists('register_nav_menus')) : </li></ul><ul><li>register_nav_menus(array( 'topmenu' => __('Top Menu'), 'catnav' => __('Cat Nav') </li></ul><ul><li>)); </li></ul><ul><li>endif; </li></ul>
  9. 9. Custom Navigation Version <ul><li><div id=&quot;catnav&quot;> <div id=&quot;nav&quot;> <?php wp_nav_menu( array( 'theme_location' => 'catnav' ) ); ?> </div> </div><!-- /catnav --> </li></ul>

×