PostTypes v3.0

testsarrow-up-right codecovarrow-up-right Latest Stable Versionarrow-up-right Total Downloadsarrow-up-right Licensearrow-up-right

Modern PHP abstractions for WordPress post types and taxonomies.

Migrating from v2 to v3

Important: v3.0 is a breaking release. Existing v2 post type and taxonomy definitions will not work without modification. Please review the migration guide in the documentationarrow-up-right on how to upgrade to version 3.

Requirements

Installation

Install with composer

Run the following in your terminal to install PostTypes with Composerarrow-up-right.

$ composer require jjgrainger/posttypes

PostTypes uses PSR-4arrow-up-right autoloading and can be used with the Composer's autoloader. See Composer's basic usagearrow-up-right guide for details on working with Composer and autoloading.

Basic Usage

Create a custom post type

Custom post types are defined as classes that extend the base PostType class. At a minimum, the name method must be implemented to define the post type slug. All other methods are optional and allow you to configure labels, options, taxonomies, admin columns, filters, and more as needed.

Register a custom post type

Once the custom post type class is created it can be registered to WordPress by instantiating and call the register method.

Notes

Author

Joe Grainger

Last updated