1. Go to this page and download the library: Download aurooba/cpt library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aurooba / cpt example snippets
// Yep feel free to use spaces in your name
$custom_post_type = new Aurooba\CPT( 'custom post type' );
$custom_post_type = new Aurooba\CPT(
'singular name', // singular taxonomy name, human readable
$args, // an array of custom parameters for the custom post type
$labels // an array of custom labels for the custom post type
);
$custom_post_type->add_taxonomy(
'Taxonomy', // singular taxonomy name
// array of custom parameters for the taxonomy
array(
'hierarchical' => false,
),
$labels, // array of custom labels for the taxonomy
)
/**
* Initialize a Resource Custom Post Type
* @return void
*/
function initialize_cpts() {
$resource = new Aurooba\CPT( 'resource');
}
add_action( 'after_setup_theme', 'initialize_cpts' );
/**
* Initialize a Resource Custom Post Type
* @return void
*/
function initialize_cpts_and_taxonomies() {
// initialize cpt
$resource = new Aurooba\CPT( 'resource' );
// add Resource Type taxonomy
$resource->add_taxonomy( 'Resource Type' );
}
add_action( 'after_setup_theme', 'initialize_cpts_and_taxonomies' );