[wp-hackers] URL structure for web application with wp
christian.foster at gmail.com
Sat Apr 17 19:10:34 UTC 2010
This has been driving me mad for a couple of days now and I was hoping
for some suggestions or ideas. Apologies for the long question but I
am really looking for the best possible (and most Wordpress-like) way
to set this up.
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
Basecamp uses this style:
/projects/id/ - project single
/projects/id/messages/ - messages archive
/projects/id/messages/id - message single
Wordpress is using
/project/id - project single
/projects/term - archive for all posts with project term
/message/id - message single (we check project term to get which
project it's linked to)
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
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
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.
More information about the wp-hackers