When working on the latest version of Easier Excerpts, we added functionality so the plugin would work any post type that had support for excerpts.

Testing Custom Post Types

Because you can’t know that different custom post types that a person may have on their installation of WordPress, I wrote a small plugin that creates a generic custom post type that can be customized, used, and abused in your development environment.

This way, you can install the plugin, activate it, and have a custom post type with which you can test against should your project call for it.

Testing Custom Post Types

The purpose of the plugin is this:

Creates a generic post type to be used for testing other plugins that rely on them.

And if you’re an experienced WordPress developer, then this plugin will be trivial. In fact, you probably already have some code laying around that you use to test this kind of functionality as needed.

If not, then maybe you’ll find some use for this plugin. It’s easy to get started with it, as well:

  1. After installing the plugin (but before activating it), locate generic-custom-post-type.php.
  2. Lines 48-73 provide everything you need to build the post type as needed for your project. If you require a reference for what can go here, then please see this Codex page.

Once you’ve made your changes, activate the plugin, and you should see the custom post type visible in the menu. From here, you should be able to interact with the custom post type as you would with any other post type from any other plugin or theme.

Ultimately, this plugin was a byproduct of a need for quickly testing custom post types without having to install any other plugins. If you have ways to improve the plugin, please open an issue or a pull request on GitHub.

Category:
Resources
Tags:

Join the conversation! 2 Comments

  1. I thought excerpt support was standardized across post types. Meaning, you enable it in your custom post type registration and it just works. Were any issues you discovered during testing?

Leave a Reply