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.


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.

  • 1
    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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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