Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

General Discussion

Paul Neumyer
Paul Neumyer
15,301 Points

Custom Post Types for WP Themes and Redistribution

Hey Zac Gordon ,

I have taken your courses on creating WP Themes, and I love what you are doing. However I was wondering, without using a plugin to create custom post types, would it be possible to create custom post types inside of a theme. For example, what steps would you take if you were creating a theme for redistribution, on sites like ThemeForest? Any input you provide would be helpful. Thank you.

1 Answer

Zac Gordon
Zac Gordon
Treehouse Guest Teacher

You can but it's not recommended because if someone changes their theme they loose all the custom content.

The right way is to require a custom field plugin to be installed along with the theme and then include the code in your theme to make sure the right custom post types exist and if not set them up with the plugin programmatically.

You should be able to search around and figure this out or look at how other themes tackle it. I'm going to cover this in an advanced WP theme course, but it won't be out for a while.