Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

WordPress custom post helper.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 css
Octocat-spinner-32 img
Octocat-spinner-32 js
Octocat-spinner-32 .gitignore
Octocat-spinner-32 custom_post_helper.php
Octocat-spinner-32 readme.md
readme.md

Custom Post Helper for Wordpress

This is a Custom Post type helper for WordPress to easily create custom post types,taxonomies and meta boxes. This class is based off of Jeffrey Way, Gijs Jorissen and Tammy Hart.

Install

Include the class in your functions.php and add the css and js into template directory.

Usage

To add a custom post type simply call the CP_Helper and pass a name

$car = new CP_Helper( 'Car' );

If you want to override defaults

$car = new CP_Helper( 'Car',
            array( 'supports' => array( 'title', 'editor', 'excerpt' ) )
);

Add Custom taxonomies

To add Custom Taxonomies, simply call the add_taxonomy.

$car->add_taxonomy( 'Model' );

Add Metaboxes

First argument is the title of the meta box and the second you must pass an array for each field.

$car->add_meta_box(
    'Car Info', array(
        array(
            'name' => 'Car Image',
            'label' => 'Car Image',
            'desc' => 'Please select an image',
            'type' => 'image',
            ),
        array(
            'name' => 'Car Description',
            'label' => 'Car Description',
            'desc' => 'Please enter a description for the car',
            'type' => 'wyiwyg',
            ),
    ));
Something went wrong with that request. Please try again.