2017 © Pedro Peláez
 

library posttypes

Simple WordPress custom post types.

image

jjgrainger/posttypes

Simple WordPress custom post types.

  • Tuesday, March 27, 2018
  • by jjgrainger
  • Repository
  • 19 Watchers
  • 172 Stars
  • 14,036 Installations
  • PHP
  • 10 Dependents
  • 0 Suggesters
  • 23 Forks
  • 9 Open issues
  • 12 Versions
  • 27 % Grown

The README.md

PostTypes v2.2.1

tests codecov Latest Stable Version Total Downloads License, (*1)

Simple WordPress custom post types., (*2)

Requirements

Installation

Install with composer

Run the following in your terminal to install PostTypes with Composer., (*3)

$ composer require jjgrainger/posttypes

PostTypes uses 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., (*4)

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

use PostTypes\PostType;

$books = new PostType( 'book' );

$books->register();

See Composer's basic usage guide for details on working with Composer and autoloading., (*5)

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., (*6)

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

// Import PostTypes.
use PostTypes\PostType;
use PostTypes\Taxonomy;

// 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

Author

Joe Grainger, (*7)

The Versions

27/03 2018

dev-master

9999999-dev https://github.com/jjgrainger/posttype

Simple WordPress custom post types.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

27/03 2018

2.0.1

2.0.1.0 https://github.com/jjgrainger/posttype

Simple WordPress custom post types.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

27/03 2018

v2.0.1.x-dev

2.0.1.9999999-dev https://github.com/jjgrainger/posttype

Simple WordPress custom post types.

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

24/10 2017

2.0

2.0.0.0 https://github.com/jjgrainger/posttype

Simple WordPress custom post types.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

17/09 2017

dev-rc-v2.0

dev-rc-v2.0 https://github.com/jjgrainger/posttype

Simple WordPress custom post types.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

17/09 2017

dev-add-column-tests

dev-add-column-tests https://github.com/jjgrainger/posttype

Simple WordPress custom post types.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

13/07 2017

dev-add-taxonomy-tests

dev-add-taxonomy-tests https://github.com/jjgrainger/posttype

Simple WordPress custom post types.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

04/07 2017

dev-add-posttype-tests

dev-add-posttype-tests https://github.com/jjgrainger/posttype

Simple WordPress custom post types.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

19/05 2017

1.1.2

1.1.2.0 https://github.com/jjgrainger/posttype

Simple WordPress custom post types.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

02/05 2017

v1.1.1

1.1.1.0 https://github.com/jjgrainger/posttype

Simple WordPress custom post types.

  Sources   Download

MIT

The Requires

 

28/04 2017

v1.1

1.1.0.0 https://github.com/jjgrainger/posttype

Simple WordPress custom post types.

  Sources   Download

MIT

The Requires

 

16/08 2016

v1.0

1.0.0.0 https://github.com/jjgrainger/posttype

A single class to help you build more advanced custom post types quickly.

  Sources   Download

MIT

The Requires

  • php >=5.3.0