WordPress as a CMS: 5 8 Power Tips for Template Developers

Home page face lift for NELLCO

Current section navigation in WordPress

Increasingly, we’re building sites – like our own – that are completely managed by WordPress. WordPress makes it very easy to output a list of pages using the wp_list_pages function; you can control depth levels, surrounding tags, and even explicitly exclude certain pages. And with the precise classes that accompany the output HTML elements, you can finely control the output with stylesheets.

Many sites, also like ours, list pages only under the current top level page (or, put another way, pages in the current section) in a sidebar. For example, if you go to the Services page, or any of the pages inside that section, you’ll notice a box atop the right sidebar called “More in Services” that provides navigation within the Services section.

Taking advantage of the wp_list_pages function to create section-based navigation for sites with two levels of page depth is a pretty straightforward matter, as I’ll explain. But how do we efficiently output section based navigation for sites with 3 or more levels of page depth?

Continue reading Current section navigation in WordPress