[wp-hackers] child pages of custom post listing pages

Mike Schinkel mikeschinkel at newclarity.net
Mon Jan 3 00:05:57 UTC 2011


On Jan 2, 2011, at 10:03 AM, Steve Taylor wrote:
> I've got a custom post type "campaign". Using the rewrite parameter of
> register_post_type, I've set the slug to "campaigns". All good so far
> - the URL for a campaign is:
> 
> /campaigns/name-of-a-campaign/
> 
> However, I've created a page with the slug "campaigns" to act as a
> listing page for campaigns. We also need a child page of this page
> with generic information on campaigns, e.g.
> 
> /campaigns/info/
> 
> Viewing this page returns a 404.
> 
> Obviously it's related to http://core.trac.wordpress.org/ticket/13818
> - which is coming in 3.1, right? If I've understood this feature,
> it'll negate the need to create a page called "campaigns" as I've
> done. The /campaigns/ URL will automatically load a template that'll
> list that post type in some way.
> 
> But I'm guessing this feature will mean that I won't be able to have
> generic pages at the same level as a campaign. I would need to have
> campaigns with this URL:
> 
> /campaigns/name-of-a-campaign/
> 
> But my info page would have to be something like:
> 
> /campaigns-info/
> 
> And in terms of how the site structure and nav appears to the user,
> I'd have to "fake" the above page being in the campaigns "section"?
> 
> Am I looking at custom rewrite rules to have my cake and eat it?

No problem.  Create a single rewrite rule with a higher priority than the rewrite rules of the custom post type. This answer will probably explain enough to get you there:

http://wordpress.stackexchange.com/questions/858/#873

Hope this helps.
-Mike


More information about the wp-hackers mailing list