https://github.com/apsislabs/carpenter
A scaffolding plugin for WordPress Content Types
https://github.com/apsislabs/carpenter
Last synced: 3 months ago
JSON representation
A scaffolding plugin for WordPress Content Types
- Host: GitHub
- URL: https://github.com/apsislabs/carpenter
- Owner: apsislabs
- Created: 2015-10-05T23:41:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-06-15T14:04:01.000Z (almost 4 years ago)
- Last Synced: 2025-01-14T09:13:52.356Z (5 months ago)
- Language: PHP
- Size: 21.5 KB
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Carpenter
Carpenter is a simple-to-use plugin for adding custom post-types and taxonomies to your WordPress plugins and themes. To use, simply install the Carpenter plugin, then include a post-type registration file somewhere in your theme or plugin files.
## API
Post types are built using standard PHP arrays. Here's an example file that would create a custom Post Type with its own custom Taxonomy.
```
if ( function_exists('build_post_types') ) {
$postTypeData = array(
'slug' => array(
'singular' => 'Post Type',
'plural' => 'Post Types',
'options' => array(),
'taxonomies' => array(
'taxonomy_slug' => array(
'singular' => 'Taxonomy',
'plural' => 'Taxonomies',
'options' => array(
'hierarchical' => true
),
'defaults' => array(
'term_slug' => array(
'name' => 'Default Term',
'options' => array(
'description' => 'A default term — this cannot be deleted by users.'
)
),
'child_term_slug' => array(
'name' => 'Default Child Term',
'options' => array(
'parent' => 'term_slug' // parents are assigned by slug
)
)
)
)
)
)
);build_post_types($postTypeData);
}
```- **slug**: Your post type's slug, unless overriden.
- **singular**: The singular name for your post type. This will be passed through WordPress's i18n functions.
- **plural**: The plural name for your post type. This will be passed through WordPress's i18n functions.
- **options**: For overriding the default options when necessary. This is an array that is identical to the `args` param for the native `register_post_type` function.
- **taxonomies**: If you'd like to include a taxonomy for your post type, create it here.
+ **taxonomy_slug**: The slug for your taxonomy.
+ **singular**: The singular name for your taxonomy. This will be passed through WordPress's i18n functions.
+ **plural**: The plural name for your taxonomy. This will be passed through WordPress's i18n functions.