[wp-hackers] URL structure for web application with wp

Mike Schinkel mikeschinkel at newclarity.net
Sat Apr 17 23:59:02 UTC 2010


On Apr 17, 2010, at 3:10 PM, Christian Foster wrote:
> I'm building a basic project management system. This is the setup:
> 
> Custom post types: Project, Milestone, Task, Message
> Taxonomies: Projects, Task List, Message Categories
> 
> Obviously this app needs to be project-centric - so whatever post,
> archive or taxonomy we're viewing generally it should relate to a
> project. So - all post types are linked to a project via a term in the
> projects taxonomy that has the same name as 1 project.
> 
> Example: Project 1 (post type project) is linked to term "Project 1"
> from the projects taxonomy. Message 1...Message 10 are also linked via
> term "Project 1" in Projects taxonomy.
> 
> Therefore when viewing any individual post, we can check the term
> they're linked to in the "Projects" taxonomy and find out which
> project we are talking about. But, when viewing an archive we have no
> way to reference which project is being referenced unless we put
> something in the URL (or set a session variable which I also played
> with).
> 
> So - what do people think the best way of structuring the app might
> be? Here are what I see as the options at the moment:
> 
> 1. Create pages as so
> /projects/project-id
> /projects/messages/project-id
> /projects/tasks/project-id
> 
> Create custom rewrite rules, stick a project id on the end of the url
> on all of the above and then do custom page templates to look up and
> display the correct posts. Or some variation of URL rewriting and
> pages with custom templates.
> 
> 2. Try to achieve functionality like categories where project is a
> category and we can link all post types into it and get the same style
> of paths:
> /projects/project-slug/task-name
> /projects/project-slug/message-name
> /projects/project-slug/project-name
> 
> Wordpress is rewriting all custom post types as /post-type/slug at the
> moment, so I am not sure if this is achievable.
> 
> 3. Some other solution using sessions to set the current project and
> then relating all queries to that project.
> 
> Having written all of that I guess any of those options would do, I'm
> just not quite able to get a neat and tidy solution out though - any
> ideas would be appreciated.

Your need provides a good example use-case for this ticket:

http://core.trac.wordpress.org/ticket/12935

On Apr 17, 2010, at 5:31 PM, scribu wrote:
> To link posts to other posts, I would use a posts2posts table, instead of
> the taxonomy system: fewer tables => better performance, easier to maintain
> consistency.

But that unfortunately requires creating significant admin UI, doesn't it?  Linking posts through the taxonomy system means that at least most of the plugin work can be done as backend code.

That said, every use case I look at has the need to related posts to other posts so much so that I can't imagine it not being a valuable addition to core. For example, to have a meta box that lets you related a post to posts of another type. Anyone know if there are any trac tickets for this?

On Apr 17, 2010, at 3:40 PM, Charles Frees-Melvin wrote:
> I think you are running into a complexity/limitation of WordPress. That a taxonomy cannot have meta.

I pondered a while back if wp_term_taxonomy shouldn't be deprecated and replaced with a post type of 'term_taxonomy' to which some derided the suggestion. Maybe now that custom post types are more mature considering it might actually make sense?

-Mike


More information about the wp-hackers mailing list