Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bvalosek/custom-post-type

A fluent-style wrapper for creating custom post types for Wordpress
https://github.com/bvalosek/custom-post-type

Last synced: 10 days ago
JSON representation

A fluent-style wrapper for creating custom post types for Wordpress

Awesome Lists containing this project

README

        

# Fluent-style Custom Post Type for Wordpress
A simple [fluent API wrapper](http://en.wikipedia.org/wiki/Fluent_interface)
for creating custom post types in Wordpress.

## Installing
All functionality is contained in the `CustomPostType` class in the
`CustomPostType.php` file. You can either copy it into an included class path
directory and use an
[autoloader](http://php.net/manual/en/language.oop5.autoload.php) or simply use
a `require_once()` call in your PHP file.

## Usage

Assuming you're using a class autoloader

```php
slug('product')
->labels('Product', 'Products')
->custom_text_meta('Tagline')
->custom_text_meta('Product URL')
->menu_icon(plugin_dir_url(__FILE__) . 'img/store.png')
->supports(array('title', 'editor', 'thumbnail', 'revisions'))
->create();
```