How to Use WordPress Walker Classes

The WordPress walker class walks a tree structure in a database, for example, the Category hierarchy and spits out HTML that represents it.

The walker class encapsulates the basic functionality necessary to output HTML representing WordPress objects with a tree structure. For instance pages and categories are the two types of objects that the WordPress 2.2 code uses the walker class to enumerate. While one could always display categories as you wished by using right func and looping through them using it takes a great deal of work to arrange subcategories below their parents with proper formatting. The walker class takes care of most of this work for you.

Some resources for learning how to use the Walker class

http://www.wprecipes.com/how-to-modify-lists-like-categories-and-blogroll-in-wordpress

http://bugssite.org/blog/2009/12/08/wordpress-custom-walker-tutorial/

http://brandonwamboldt.ca/writing-a-custom-walker-class-in-wordpress-382/

http://scribu.net/wordpress/extending-the-category-walker.html

http://www.kriesi.at/archives/improve-your-wordpress-navigation-menu-output

http://www.hashbangcode.com/blog/extending-wordpress-page-walker-518.html

http://codex.wordpress.org/Function_Reference/Walker_Class

Comments are closed.