Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Custom Post Type - Is This Possible

I am setting up a directory style site and am using the Custom Fields and Custom Post Types Plug-ins.

I have businesses listed in 12 different categories and have icons on the homepage that will link to each of the business types.

Do I need to setup custom post types for each of the types of businesses that I want to list? In other words 12 different Custom Post Types - 1 for each business type that I want and then pull each Custom Post Type to a Custom Page Template?


Can I setup a field in the Custom Post Types for Business Type and then call on only certain business types in a custom page template?

If this doesn't make sense please let me know and I'll see if I can be a little clearer on what it is I need.

2 Answers

Not sure if anyone can come up with something different to make this simpler but here is what I came up with:

I created a custom page template for each of the 'categories' of business listings that I wanted to have. I then added a custom loop to each of these templates to only pull the 'category' from one of the custom fields

Seems to be working fine - we'll see once I have more listings and have the rest of the theme coded.

Matt Campbell
Matt Campbell
9,767 Points

Hi Mike Pickett.

If it's only going to be you editing the site then the way you are suggesting is the way to go.

Do you want users to be able to edit their listing or anything?

I'm launching a directory based site later this year but with the emphasis on users being able to have a micro-site so they can add pictures, write things, link Facebook posts etc. it's going to be a mammoth undertaking but, I have given directories a lot of thought during stage 1 of 4 for the new project.

Matthew Campbell

Thank you for responding. Yes - we're working this site ourselves, no user input on this one. It's a niche site so there will only be a few entries each month. Not to mention I really want to have full control over the content, images...etc. I can't stand it when I design a clean looking site only to have it messed up by user input.

Good luck with your project - I am thinking about the same thing for next year.