Wallogit.com
2017 © Pedro Peláez
Raskoh - easy wordpress CPT and Taxonomy registration
Registring custom post types and taxonomies in wordpress is not a headache anymore. Raskoh will make your life simpler., (*1)
, (*2)
You can insall Raskoh as a wordpress plugin by downloading the package and pulling it in wp-content/plugins folder or
using composer., (*3)
Paste this in composer.json file, (*4)
{
"require" : {
"azi/raskoh" : "1.*"
}
}
or just run this command in your project.
$ composer require azi/raskoh, (*5)
include composers autoloader in your theme's functions.php, (*6)
require_once "vendor/autoloader.php";
to register a post type, (*7)
$music = new Raskoh\PostType("Music");
$music->register();
register a taxonomy along with post type, (*8)
$music = Raskoh\PostType::getInstance("Music");
$music->taxonomy('Singer')->register();
if you want to add Terms dropdown on WordPress admin interface to restrict posts by terms. just pass a second boolean to
php PostType::taxonomy($name, $filters = false) method., (*9)
$music = Raskoh\PostType::getInstance("Music");
$music->taxonomy('Singer', true)->register();
$music = Raskoh\PostType::getInstance("Music");
$music->taxonomy(['singer','genre'])->register();
you can also set icons to your post type, (*10)
$music = Raskoh\PostType::getInstance("Music");
$music->taxonomy('Singer')->setIcon('dashicons-format-audioy')->register();
you can pass all other arguments listed at Codex for wp_register_post_type() like this, (*11)
$CPT = Raskoh\PostType::getInstance();
$CPT->set{ArgumentName}