1. Go to this page and download the library: Download mindkomm/types 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/ */
mindkomm / types example snippets
/**
* Register post types for your theme.
*
* Pass a an array of arrays to the registration function.
*/
add_action( 'init', function() {
Types\Post_Type::register( [
// Always use an English lowercase singular name to name a post type.
'example' => [
'name_singular' => 'Example',
'name_plural' => 'Examples',
'args' => [
/**
* For a list of possible menu-icons see
* https://developer.wordpress.org/resource/dashicons/
*/
'menu_icon' => 'dashicons-building',
'hierarchical' => false,
'has_archive' => false,
'supports' => [
'title',
'editor',
],
// Whether post is accessible in the frontend
'public' => false,
],
'admin_columns' => [
'date' => false,
],
],
] );
} );
use Types\Taxonomy;
/**
* Register taxonomies for your theme.
*
* Pass a an array of arrays to the registration function.
*/
add_action( 'init', function() {
Taxonomy::register( [
// Always use an English lowercase singular name to name a taxonomy.
'example_tax' => [
'name_singular' => 'Example Category',
'name_plural' => 'Example Categories',
// For which post types do you want to register this taxonomy?
'for_post_types' => [ 'example' ],
'args' => [
// Hide the meta box from the edit view
// 'meta_box_cb' => false,
//
// Make it selectable in the navigation menus
// 'show_in_nav_menus' => true,
],
],
] );
} );