palmtree/wp-custom-post-type

WordPress Custom Post Types

v4.0.0 2022-05-30 11:01 UTC

This package is auto-updated.

Last update: 2024-11-29 05:09:34 UTC


README

License

Library to assist in the creation of custom post types within WordPress.

Requirements

  • PHP >= 7.1

Installation

Use composer to add the package to your dependencies:

composer require palmtree/wp-custom-post-type

Usage

Basic Usage

<?php
use Palmtree\WordPress\CustomPostType\CustomPostType;

$project = new CustomPostType('project');

$callToAction = new CustomPostType([
    'post_type' => 'cta',
    'public' => false,
]);

Advanced Usage

<?php
use Palmtree\WordPress\CustomPostType\CustomPostType;

$project = new CustomPostType([
    'post_type' => 'project',
    'front' => 'my-projects',
    'taxonomies' => [
        [
            'name' => 'Project Tags',
            'hierarchical' => false,
        ],
        [
            'name' => 'Project Categories',
            'singluar_name' => 'Project Category',
        ]
    ],
]);

License

Released under the MIT license