Cuisine is a WordPress utilitybelt / framework aimed at making WordPress development easy, quick and fun.
Prerequisite | How to check | How to install |
---|---|---|
PHP >= 5.4.x | php -v |
php.net |
- Completely OOP
- Field- Metaboxbuilders
- Asset pipeline for Sass files and Scripts
- Quickly add new Post Types, Taxonomies and Routing
- Cleans up the eventual HTML output
- Some handy shortcodes ( buttons, google analytics event links, etc. )
Clone the git repo - git clone https://github.com/cuisine-wp/cuisine.git
or install with composer:
composer require chefduweb/cuisine
After you have all the files you need to install cuisine like a regular WordPress plugin:
- move the files to wp-content/plugins
- get into the WordPress admin and go to plugins
- activate Cuisine.
Creating plugins and themes with the power of Cuisine is quite easy; you just create regular WordPress themes & plugins. However, if you want to start off with some boilerplate code we recommand Carte Blanche, our WordPress empty-canvas theme and Crouton, a scaffolded plugin.
Full documentation on Cuisine Core, as well as other plugins is available at docs.get-cuisine.cooking. Here's a short list of our most important plugins:
Here are a few quick examples on how Cuisine will be making your life easier:
/**
* register a custom post type:
* @param string post_type
* @param string plural label
* @param string singular label
* @set-param array regular post_type arguments (optional)
*/
PostType::make( 'project', 'Projects', 'Project' )->set( $params );
//register a custom taxonomy
//@make params: slug, post_type, plural, singular
/**
* register a custom taxonomy
* @param string slug
* @param string post_type
* @param string Plural label
* @param string Singular label
* @set-param array regular taxonomy arguments (optional)
*/
Taxonomy::make( 'client', 'project', 'Clients', 'Client' )->set($params);
/**
* register a custom rewrite for the post_type 'project'
* @param string post_type
* @param string overview-url
* @param string singular-url
*/
Route::url( 'project', 'our-work', 'project' );
//route a post_type to a custom template
/**
* register a custom template redirect for the post_type 'project'
* @param string post_type
* @param string overview-template filename
* @param string single-template filename (optional, defaults to {$post_type}-single.php );
*/
Route::template( 'project', 'our-work', 'project' );
//fields in an array, for use in the metabox
$fields = array(
//creating a simple text-field:
Field::text( 'field_name', 'Field Label' ),
//adding more variables:
Field::text(
'field_name_2',
'Field Label 2',
array(
'defaultValue' => 'This is a Textfield',
'validate' => array( 'required', 'textual' ),
'placeholder' => 'Put yer text here'
)
),
//Media gallery
Field::media(
'media',
'Image',
array(
'label' => 'top'
)
)
);
/**
* Create a metabox on the fly
* @param string Metabox-name
* @param mixed post_type (string or array of strings)
*/
Metabox::make( 'A Metabox', 'post' )->set( $fields );
Building a metabox like this gives you the following result:
This metabox will automatically validate and save the fields in it. So you can get the results of the first text-field by using get_post_meta( get_the_ID(), 'field_name', true );
.
//get the url of this plugin:
$url = Url::plugin( 'crouton/Assets/' );
/**
* Register a script
* @param string ID
* @param string Url of the file ( file extension optional )
* @param bool Auto-load this script from the get-go
*/
Script::register( 'crouton-script', $url.'Frontend', false );
/**
* Register a sass-file
* @param string ID
* @param string Url of the file ( file extension optional )
* @param bool Force-overwrite this sass-file
*/
Sass::register( 'template', $url.'_template', false );
Everyone is welcome to help contribute and improve this project. There are several ways you can contribute:
- Reporting issues
- Suggesting new features
- Writing or refactoring code
- Fixing issues