PHPackages                             oberonlai/wp-cpt - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. oberonlai/wp-cpt

ActiveLibrary

oberonlai/wp-cpt
================

Simple WordPress custom post types.

v1.0.2(4y ago)116MITPHPPHP &gt;=7.2

Since Aug 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/oberonlai/wp-cpt)[ Packagist](https://packagist.org/packages/oberonlai/wp-cpt)[ Docs](https://github.com/jjgrainger/posttype)[ RSS](/packages/oberonlai-wp-cpt/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

PostTypes v2.1
==============

[](#posttypes-v21)

[![Build Status](https://camo.githubusercontent.com/91fcd83fa425c45033eebc18e64877d6cf008d454c4f1e682c0cd7523740213d/68747470733a2f2f666c61742e62616467656e2e6e65742f7472617669732f6a6a677261696e6765722f506f737454797065733f6c6162656c3d6275696c64)](https://travis-ci.org/jjgrainger/PostTypes) [![Latest Stable Version](https://camo.githubusercontent.com/7039ce0d48c22fb0fcc980183ab43d1d24d21d7c529f402f42f2be03845fcf0f/68747470733a2f2f666c61742e62616467656e2e6e65742f6769746875622f72656c656173652f6a6a677261696e6765722f506f737454797065732f737461626c65)](https://packagist.org/packages/jjgrainger/posttypes) [![Total Downloads](https://camo.githubusercontent.com/196b6a7f83015101bc859abe64760c4dd9fe492f9f3b61c9cc45e0823e8304b0/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f64742f6a6a677261696e6765722f506f73745479706573)](https://packagist.org/packages/jjgrainger/posttypes) [![License](https://camo.githubusercontent.com/d7283ad6ae26c10ea00ca16f3ed4c662b1a8ea5d15e98f797c5db704bb204998/68747470733a2f2f666c61742e62616467656e2e6e65742f6769746875622f6c6963656e73652f6a6a677261696e6765722f506f73745479706573)](https://packagist.org/packages/jjgrainger/posttypes)

> Simple WordPress custom post types.

Requirements
------------

[](#requirements)

- PHP &gt;=7.2
- [Composer](https://getcomposer.org/)
- [WordPress](https://wordpress.org) &gt;=5.1

Installation
------------

[](#installation)

#### Install with composer

[](#install-with-composer)

Run the following in your terminal to install PostTypes with [Composer](https://getcomposer.org/).

```
$ composer require jjgrainger/posttypes

```

PostTypes uses [PSR-4](https://www.php-fig.org/psr/psr-4/) autoloading and can be used with the Composer's autoloader. Below is a basic example of getting started, though your setup may be different depending on how you are using Composer.

```
require __DIR__ . '/vendor/autoload.php';

use PostTypes\PostType;

$books = new PostType('book');

$books->register();
```

See Composer's [basic usage](https://getcomposer.org/doc/01-basic-usage.md#autoloading) guide for details on working with Composer and autoloading.

Basic Usage
-----------

[](#basic-usage)

Below is a basic example of setting up a simple book post type with a genre taxonomy. For more information, check out the [online documentation here](https://posttypes.jjgrainger.co.uk).

```
// Require the Composer autoloader.
require __DIR__ . '/vendor/autoload.php';

// Import PostTypes.
use PostTypes\PostType;

// Create a book post type.
$books = new PostType( 'book' );

// Attach the genre taxonomy (which is created below).
$books->taxonomy( 'genre' );

// Hide the date and author columns.
$books->columns()->hide( [ 'date', 'author' ] );

// Set the Books menu icon.
$books->icon( 'dashicons-book-alt' );

// Register the post type to WordPress.
$books->register();

// Create a genre taxonomy.
$genres = new Taxonomy( 'genre' );

// Set options for the taxonomy.
$genres->options( [
    'hierarchical' => false,
] );

// Register the taxonomy to WordPress.
$genres->register();
```

Notes
-----

[](#notes)

- The full documentation can be found online at [posttypes.jjgrainger.co.uk](https://posttypes.jjgrainger.co.uk)
- The class has no methods for making custom fields for post types, use [Advanced Custom Fields](https://advancedcustomfields.com)
- The book's example used in the README.md can be found in [examples/books.php](examples/books.php)
- Licensed under the [MIT License](https://github.com/jjgrainger/wp-posttypes/blob/master/LICENSE)
- Maintained under the [Semantic Versioning Guide](https://semver.org)

Author
------

[](#author)

**Joe Grainger**

-
-

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1731d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1587136?v=4)[Oberon Lai](/maintainers/oberonlai)[@oberonlai](https://github.com/oberonlai)

---

Top Contributors

[![oberonlai](https://avatars.githubusercontent.com/u/1587136?v=4)](https://github.com/oberonlai "oberonlai (3 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/oberonlai-wp-cpt/health.svg)

```
[![Health](https://phpackages.com/badges/oberonlai-wp-cpt/health.svg)](https://phpackages.com/packages/oberonlai-wp-cpt)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
