WordPress Proposal: “Deep” Linking Taxonomies to Custom Posts

EDIT: A very awesome plugin that does this and much more, exists. Go check out Piklist.

Scenario

You are building a site for an educational institute. There are several requirements:

  • Speakers - These are the people giving the courses. There could be different speakers for the same course, if there are too many students for one course, or on different years.
  • Courses - Each course could be unique, or it could be the same required course that every student needs to take to get through.
  • Dates - The duration. If you’re dealing with conferences, it could be a single date. If it’s a course, it may be a time-frame.

Each of these could and should be a custom post type. And each would have its own custom taxonomy. Speakers should have a Department taxonomy. Courses should as well. Dates should have a Semester taxonomy.

Here’s where things get interesting. What if a Speaker had a taxonomy of Course, so all the lecturers of a specific Course could link themselves to that Course? Wouldn’t it make sense for both Courses and Dates to have the Semester taxonomy?

Proposed solution

In addition to linking taxonomies to all other posts with that taxonomy, there is adding the ability to link a taxonomy to a specific custom post as well. This is similar to descriptions for categories, however, taxonomies do not have meta. Posts do.

This way, when you visit this educational institute’s site and you’re looking at a course, but you’d like to see more about the speaker, you can click one taxonomy link and see all other courses tagged with the speaker, or you can click straight through to the post about that speaker.

The opposite linking works just as well. You’re looking at a speaker and would like to learn more about a course they teach. The course is already a taxonomy, so you could click and see all the other Speakers who are tagged with this course, i.e. all the Speakers who teach this. Or you could click through to the course itself.

Obviously this can be done already. Just not automatically, or easily.

How

If this were build as a plugin I would create a look-up table linking the taxonomy ID to a post ID. If it were to be incorporated into the core, I would extend <code>wp_term_taxonomy</code> with another column that would associate the taxonomy term with the specific custom post ID. A link could be generated with a function like get_term_post_link().

I think I’ll go ahead and write this plugin now…

EDIT: It exists!