WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have gotten pretty good at creating CPT's for clients sites, but now would like to take it a step further by making them plugins outside of the theme so when/if they decide to change themes it is one less thing I need to think about. Or maybe it is a really well thought out CPT and want to offer it to others to install on their site through the plugin repo.

I was wondering how to do this? I know I need to create the views, but not sure how to register them and make it all come together.

share|improve this question

There are other factors that you'll discover along the way, but basically it boils down to: move all that's CPT related from your theme's functions.php to a plugin file.

Create a PHP file, put the plugin's header information, add to the plugins folder, activate. Now, you separated appearance (theme) from functionality (plugin). Here are two fundamental Q&A's here in WPSE:

And here a related blog post.

You'll find many examples of in the site archives.

share|improve this answer
Thank you so much! Great job laying out the resources available! – 465Media Oct 24 '13 at 3:02
I was librarian when young ;) – brasofilo Oct 24 '13 at 3:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.