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!
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
Paul Neumyer15,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.
Zac GordonTreehouse 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.