[wp-hackers] Page categories

Mark Jaquith mark.wordpress at txfx.net
Thu Apr 12 20:37:31 GMT 2007


On Apr 12, 2007, at 12:06 PM, Elliotte Harold wrote:

> 2. The goal is to be able to say wp_list_pages(categories="Birding  
> Blogging") and get a list all pages that match one of those  
> categories.
>
>
> It doesn't have to be categories. Tags might work. But we do need  
> something that's in between "Give me exactly these pages with these  
> IDs" and "Give me all pages".
>
> Subpages are about the hierarchy of the site. That's a different  
> story. What I'm trying to do here is get a list of links to all the  
> pages in a given category, not actually display the pages themselves.

Example:

hierarchy:

* Bird Blogging
	- Birds of prey
	- Songbirds
	- Bird-watching equipment

code:

<?php

$birds = get_page_by_path('bird-blogging');
$birds_array['child_of'] = (int) $birds->ID;

// or if you know the ID, just
// provide it and save a query

$birds_array['title_li'] = '';

wp_list_pages($birds_array);

?>

The only thing you don't get that you'd get from categories is having  
Pages exist in multiple categories (as they can only have one  
parent), but this sounds like it might work for some uses.

While subpages are about hierarchy, they can also be about grouping  
for convenience.

--
Mark Jaquith
http://markjaquith.com/

Covered Web Services
http://coveredwebservices.com/




More information about the wp-hackers mailing list