PHPackages                             itsmejgrant/custom-post-type-helper - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. itsmejgrant/custom-post-type-helper

AbandonedLibrary[Utility &amp; Helpers](/categories/utility)

itsmejgrant/custom-post-type-helper
===================================

A small helper package to hide away most of the config for creating Custom Post Types in WordPress

1.1.3(3y ago)3553[1 issues](https://github.com/itsmejgrant/custom-post-type-helper/issues)MITPHPPHP &gt;=7.4

Since Mar 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/itsmejgrant/custom-post-type-helper)[ Packagist](https://packagist.org/packages/itsmejgrant/custom-post-type-helper)[ RSS](/packages/itsmejgrant-custom-post-type-helper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (8)Used By (0)

Custom Post Type Helper
=======================

[](#custom-post-type-helper)

A super simple abstraction to make creating a Custom Post Types in WordPress a *breeze.*

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

[](#installation)

You can either a) install with composer or b) copy the main the file and require it your functions file.

### Composer

[](#composer)

In your terminal, in the directory where your composer.json is (usually the theme directory):

`composer require itsmejgrant/custom-post-type-helper`

Then, in your `function.php` file:

`use Itsmejgrant\CustomPostTypeHelper\CustomPostType`

That's it, you're ready to go!

### Manual installation

[](#manual-installation)

Copy the contents of the `CustomPostType.php` file and put it whereever makes sense in your theme directory.

Require it whereever you will be using it with:

`require 'path/to/your/file.php';`

Usage
-----

[](#usage)

To use the helper, assign a new instance to a variable and manipulate as required. The only required argument is the name of the post type, however it's recommended to also pass a second argument to display a custom menu icon.

Example:

```
function my_custom_function() {
  // Includes optional menu icon argument
  $books = new CustomPostType('Books', 'dashicons-book');
}
add_action('init', 'my_custom_function');
```

By default, labels are based of the name passed as the first argument. You can override any of them using the `set_labels()` method. For example, we could the singular name if it doesn't make sense. The default for this is the name argument without the 's'.

```
function my_custom_function() {
  $people = new CustomPostType('People');
  $people->set_labels([
    'singular_name' => 'Person'
  ]);
}
add_action('init', 'my_custom_function');
```

The `set_labels()` method an array of labels for this post type. Please see [here for a list of supported labels](https://developer.wordpress.org/reference/functions/get_post_type_labels/)

Similarly, the `set_args()` method allows us to override the default arguments.

```
function my_custom_function() {
  $sandwiches = new CustomPostType('Sandwich');
  $sandwiches->set_args([
    'menu_icon' => 'dashicon_sandwich'
  ]);
}
add_action('init', 'my_custom_function');
```

[See here for a list of supported arguments](https://developer.wordpress.org/reference/functions/register_post_type/)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Every ~25 days

Recently: every ~38 days

Total

7

Last Release

1365d ago

Major Versions

0.1.1 → 1.0.02022-03-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/982f55fbbf74eba89e6e66efa17623c96be0339da800295c79245b41feb4d444?d=identicon)[itsmejgrant](/maintainers/itsmejgrant)

---

Top Contributors

[![itsmejgrant](https://avatars.githubusercontent.com/u/26424501?v=4)](https://github.com/itsmejgrant "itsmejgrant (10 commits)")

---

Tags

custompostypeshelperphpwordpress

### Embed Badge

![Health badge](/badges/itsmejgrant-custom-post-type-helper/health.svg)

```
[![Health](https://phpackages.com/badges/itsmejgrant-custom-post-type-helper/health.svg)](https://phpackages.com/packages/itsmejgrant-custom-post-type-helper)
```

PHPackages © 2026

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