Skip to content

Instantly share code, notes, and snippets.

@imgiseverything
Created February 29, 2012 10:52
Show Gist options
  • Save imgiseverything/1939932 to your computer and use it in GitHub Desktop.
Save imgiseverything/1939932 to your computer and use it in GitHub Desktop.
IMG Custom Post Types: Example with custom meta fields and data types
if (class_exists('IMGCustomPostTypes') === true ) { // check for plugin activation
// 1 Initialise a new custom post type
$cpt_example = new IMGCustomPostTypes();
// 2 Add your custom fields - appending _textarea or _boolean changes the custom meta field edit box
$cpt_example->customFields = array('example_foo_textarea', 'example_bar_boolean', 'example_bar_date');
// 3 Set your naming conventions
$cpt_example->namingConventions = array(
'name' => 'example',
'singular' => 'Example',
'plural' => 'Examples',
'slug' => 'example'
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment