Code Monkey home page Code Monkey logo

carpenter's Introduction

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.

carpenter's People

Contributors

wkirby avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.