A project I’ve been working on created a need and opportunity for me to explore WordPress 3.0 Custom Posts & Custom Taxonomies. There is already plenty of thorough information on this online so I will refrain from repeating. Instead I will focus on the application I found for these capabilities and my experience in creating it.
Heads Up
First make sure to read WordPress 3.0 and Custom Post Types by Otto for some really imporant clarification on what post-type are and more imporantly what they aren’t. Don’t indulge in creating them because it looks easy – there is more to it then meets the untrained eye. You may create unnecessary overhead for yourself. If you use them properly you will experience wonderful features – it you misuse them you will experience frustrations to no end.
Second, keep in mind that some obvious and basic stuff you may have learned to rely on (assuming you are a theme developer) becomes not so basic and not so obvious:
- Taxonomies are not catgeories – functions like
in_category() are not available to you – you need to write your own.
- If you want to create your own loops and you need to figure out in your templates where you are then you need to get acuainted with term related functions like
get_term_by() or is_object_in_term().
- If you want to create your own data-structures and data entry interfaces it may be a new admin-related territories for you to explore – make sure you have your code-hiking boots on for things like
add_meta_box() or less-common action hooks such as manage_posts_custom_column.
It is amazingly simple to create a new custom post type and custom taxonomy – it took me a few minutes to write the first 3 lines of code which created an entire new area in the WordPress admin. It took me the rest of a long day (and then some) to follow through and end up with a working extension.
Useful Resources
Of all the resources I visited – these are the articles that helped me in this process. I read them through at least once and then referred to them as I progressed in my work:
I used a widget called “Taxonomy Widget” to generate location links in the sidebar. It is a good for simple things – it could be made better by allowing refined selection of terms within a selected taxonomy.
Teachers Directory Application
The project included a simple directory of Yoga teachers:
- Profile Information: Each teacher has a concise profile including name, phone, email & website.
- Location: Teachers are usuallly sought out based on location (as most people look for teachers who are near to them) – so each teacher needs to be associated with a location.
- Badges: Badges were needed to communicate additional information on teacher status and qualifications.
To do this I created a custom post-type “teacher” and to custom-taxonomies “location” and “badge”. This is what it looks like in the admin main menu:

This is what a list of teachers looks like in the admin. It turned out to be an unexpected added value – a “teachers phonebook” inside the admin:

I created a custom form to enter teacher information:

And WordPress automatically created two meta-boxes for selecting locations and badges:

The Result
I hope that within a week or two the project will be launched and I will then add a screenshot of the final result and a link to the working directory.
Update (July 17, 2010) – Site Launched
The site has been launched. This included customizing the way teachers appeared in search results and adding a single teacher page. You can see the teachers-directory here.

Update
- Single Teacher Template – originally there was no need for a single-teacher template but the need came up when teachers appeared in search results. Clicking on a teacher in a search result required that a single teacher template be added.
- Search Results – the search loop had to be customized to accommodate the custom-post-type. Teachers have no “content” or “excerpt” information. The search loop was modified so that when a teacher record is encountered, an alternate presentation is created for it in the form of “Teacher: <teacher name>”.
http://wordpress.org/extend/plugins/taxonomy-widget/a widge
Creating a Teachers Directory with WordPress 3.0
A project I’ve been working on created a need and opportunity for me to explore WordPress 3.0 Custom Posts & Custom Taxonomies. There is already plenty of thorough information on this online so I will refrain from repeating. Instead I will focus on the application I found for these capabilities and my experience in creating it.
Heads Up
First make sure to read WordPress 3.0 and Custom Post Types by Otto for some really imporant clarification on what post-type are and more imporantly what they aren’t. Don’t indulge in creating them because it looks easy – there is more to it then meets the untrained eye. You may create unnecessary overhead for yourself. If you use them properly you will experience wonderful features – it you misuse them you will experience frustrations to no end.
Second, keep in mind that some obvious and basic stuff you may have learned to rely on (assuming you are a theme developer) becomes not so basic and not so obvious:
in_category()are not available to you – you need to write your own.get_term_by()oris_object_in_term().add_meta_box()or less-common action hooks such asmanage_posts_custom_column.It is amazingly simple to create a new custom post type and custom taxonomy – it took me a few minutes to write the first 3 lines of code which created an entire new area in the WordPress admin. It took me the rest of a long day (and then some) to follow through and end up with a working extension.
Useful Resources
Of all the resources I visited – these are the articles that helped me in this process. I read them through at least once and then referred to them as I progressed in my work:
I used a widget called “Taxonomy Widget” to generate location links in the sidebar. It is a good for simple things – it could be made better by allowing refined selection of terms within a selected taxonomy.
Teachers Directory Application
The project included a simple directory of Yoga teachers:
To do this I created a custom post-type “teacher” and to custom-taxonomies “location” and “badge”. This is what it looks like in the admin main menu:
This is what a list of teachers looks like in the admin. It turned out to be an unexpected added value – a “teachers phonebook” inside the admin:
I created a custom form to enter teacher information:
And WordPress automatically created two meta-boxes for selecting locations and badges:
The Result
I hope that within a week or two the project will be launched and I will then add a screenshot of the final result and a link to the working directory.
Update (July 17, 2010) – Site Launched
The site has been launched. This included customizing the way teachers appeared in search results and adding a single teacher page. You can see the teachers-directory here.
Update