2017 © Pedro Peláez
 

library extended-cpts

A library which provides extended functionality to WordPress custom post types and taxonomies.

image

johnbillion/extended-cpts

A library which provides extended functionality to WordPress custom post types and taxonomies.

  • PHP
  • 9 Dependents
  • 2 Suggesters
  • 58 Forks
  • 26 Open issues
  • 22 Versions
  • 23 % Grown

The README.md

Build Status Stable Release License PHP 7 and 8 Documentation, (*1)

Extended CPTs

Extended CPTs is a library which provides extended functionality to WordPress custom post types and taxonomies. This allows developers to quickly build post types and taxonomies without having to write the same code again and again., (*2)

Extended CPTs works with both the block editor and the classic editor., (*3)

See the wiki for full documentation., (*4)

Not your first time here? See Recent Changes for Developers to see what features are new in recent versions of Extended CPTs., (*5)

Improved Defaults for Post Types

  • Automatically generated labels and post updated messages (in English)
  • Public post type with admin UI and post thumbnails enabled
  • Hierarchical with page capability type
  • Optimal admin menu placement

Improved Defaults for Taxonomies

  • Automatically generated labels and term updated messages (in English)
  • Hierarchical public taxonomy with admin UI enabled

Extended Admin Features

  • Declarative creation of table columns on the post type listing screen:
    • Columns for post meta, taxonomy terms, featured images, post fields, Posts 2 Posts connections, and custom functions
    • Sortable columns for post meta, taxonomy terms, and post fields
    • User capability restrictions
    • Default sort column and sort order
  • Declarative creation of table columns on the taxonomy term listing screen:
    • Columns for term meta and custom functions
    • User capability restrictions
  • Filter controls on the post type listing screen to enable filtering posts by post meta, taxonomy terms, post author, and post dates
  • Override the 'Featured Image' and 'Enter title here' text
  • Several custom meta boxes available for taxonomies on the post editing screen:
    • Simplified list of checkboxes
    • Radio buttons
    • Dropdown menu
    • Custom function
  • Post types and taxonomies automatically added to the 'At a Glance' section on the dashboard
  • Post types optionally added to the 'Recently Published' section on the dashboard

Extended Front-end Features for Post Types

  • Specify a custom permalink structure:
    • For example reviews/%year%/%month%/%review%
    • Supports all relevant rewrite tags including dates and custom taxonomies
    • Automatic integration with the Rewrite Rule Testing plugin
  • Specify public query vars which enable filtering by post meta and post dates
  • Specify public query vars which enable sorting by post meta, taxonomy terms, and post fields
  • Override default public or private query vars such as posts_per_page, orderby, order, and nopaging
  • Add the post type to the site's main RSS feed

Minimum Requirements

  • PHP: 7.4
    • Tested up to PHP 8.3
  • WordPress: 5.8
    • Tested up to WP 6.7

Installation

Extended CPTs is a developer library, not a plugin, which means you need to include it as a dependency in your project. Install it using Composer:, (*6)

composer require johnbillion/extended-cpts

Other means of installation or usage, particularly bundling within a plugin, is not officially supported and done at your own risk., (*7)

Usage

Need a simple post type with no frills? You can register a post type with a single parameter:, (*8)

add_action( 'init', function() {
    register_extended_post_type( 'article' );
} );

And you can register a taxonomy with just two parameters:, (*9)

add_action( 'init', function() {
    register_extended_taxonomy( 'location', 'article' );
} );

Try it. You'll have a hierarchical public post type with an admin UI, a hierarchical public taxonomy with an admin UI, and all the labels and updated messages for them will be automatically generated., (*10)

Or for a bit more functionality:, (*11)

add_action( 'init', function() {
    register_extended_post_type( 'story', [

        # Add the post type to the site's main RSS feed:
        'show_in_feed' => true,

        # Show all posts on the post type archive:
        'archive' => [
            'nopaging' => true,
        ],

        # Add some custom columns to the admin screen:
        'admin_cols' => [
            'story_featured_image' => [
                'title'          => 'Illustration',
                'featured_image' => 'thumbnail'
            ],
            'story_published' => [
                'title_icon'  => 'dashicons-calendar-alt',
                'meta_key'    => 'published_date',
                'date_format' => 'd/m/Y'
            ],
            'story_genre' => [
                'taxonomy' => 'genre'
            ],
        ],

        # Add some dropdown filters to the admin screen:
        'admin_filters' => [
            'story_genre' => [
                'taxonomy' => 'genre'
            ],
            'story_rating' => [
                'meta_key' => 'star_rating',
            ],
        ],

    ], [

        # Override the base names used for labels:
        'singular' => 'Story',
        'plural'   => 'Stories',
        'slug'     => 'stories',

    ] );

    register_extended_taxonomy( 'genre', 'story', [

        # Use radio buttons in the meta box for this taxonomy on the post editing screen:
        'meta_box' => 'radio',

        # Add a custom column to the admin screen:
        'admin_cols' => [
            'updated' => [
                'title_cb'    => function() {
                    return '<em>Last</em> Updated';
                },
                'meta_key'    => 'updated_date',
                'date_format' => 'd/m/Y'
            ],
        ],

    ] );
} );

Bam, we now have:, (*12)

  • A 'Stories' post type, with correctly generated labels and post updated messages, three custom columns in the admin area (two of which are sortable), stories added to the main RSS feed, and all stories displayed on the post type archive.
  • A 'Genre' taxonomy attached to the 'Stories' post type, with correctly generated labels and term updated messages, and a custom column in the admin area.

The register_extended_post_type() and register_extended_taxonomy() functions are ultimately wrappers for the register_post_type() and register_taxonomy() functions in WordPress core, so any of the parameters from those functions can be used., (*13)

There's quite a bit more you can do. See the wiki for full documentation., (*14)

Contributing and Testing

Please see CONTRIBUTING.md for information on contributing., (*15)

License: GPLv2 or later

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version., (*16)

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details., (*17)

The Versions

01/11 2017

dev-develop

dev-develop https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types and taxonomies.

  Sources   Download

GPL-2.0+

The Requires

  • php ^7.0

 

The Development Requires

01/11 2017

dev-master

9999999-dev https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types and taxonomies.

  Sources   Download

GPL-2.0+

The Requires

  • php ^7.0

 

The Development Requires

01/11 2017

4.2.0

4.2.0.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types and taxonomies.

  Sources   Download

GPL-2.0+

The Requires

  • php ^7.0

 

The Development Requires

23/10 2017

4.1.0

4.1.0.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types and taxonomies.

  Sources   Download

GPL-2.0+

The Requires

  • php ^7.0

 

The Development Requires

29/08 2017

4.0.2

4.0.2.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types and taxonomies.

  Sources   Download

GPL-2.0+

The Requires

  • php >=7.0

 

The Development Requires

28/08 2017

4.0.1

4.0.1.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types and taxonomies.

  Sources   Download

GPL-2.0+

The Requires

  • php >=7.0

 

The Development Requires

28/08 2017

4.0.0.x-dev

4.0.0.9999999-dev https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types and taxonomies.

  Sources   Download

GPL-2.0+

The Requires

  • php >=7.0

 

The Development Requires

28/08 2017

4.0.0

4.0.0.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types and taxonomies.

  Sources   Download

GPL-2.0+

The Requires

  • php >=7.0

 

The Development Requires

11/06 2017

3.2.1

3.2.1.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

06/04 2017

3.2.0

3.2.0.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

21/03 2017

3.1.0

3.1.0.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

26/07 2016

3.0.3

3.0.3.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

10/03 2016

3.0.2

3.0.2.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

12/02 2016

3.0.1

3.0.1.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

20/12 2015

3.0.0

3.0.0.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

28/11 2015

2.5.2

2.5.2.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

02/11 2015

2.5.1

2.5.1.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

17/10 2015

2.5

2.5.0.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

24/09 2014

2.4

2.4.0.0 https://github.com/johnbillion/extended-cpts/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

02/04 2014

2.3.3

2.3.3.0 https://github.com/johnbillion/ExtendedCPTs/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

The Requires

 

01/04 2014

2.3.2

2.3.2.0 https://github.com/johnbillion/ExtendedCPTs/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+

04/11 2013

2.3.1

2.3.1.0 https://github.com/johnbillion/ExtendedCPTs/

A library which provides extended functionality to WordPress custom post types, allowing developers to quickly build custom post types without having to write the same code again and again.

  Sources   Download

GPL-2.0+