# Custom post type

# Widgets Post type

Some widgets come with a custom post type automaticcly initialize with the widget initalization page.

# Class

use Be\Minotaure\Widgets\Core\PostType;
1

# How to create

Two ways are available to create a new CPT (Custom Post Type)

# Minotaure way

PostType::create(string $singular_title,string $plural_title, $slug, $arguments)
1
use Be\Minotaure\Widgets\Core\PostType

PostType::create(__('Event', M_TD), __('Events', M_TD), 'events', [
    'menu_icon'     => 'dashicons-calendar-alt',
    'public'        => true,
    'supports'      => $args['supports'],
    'rewrite'       => ['slug' => __('events-slug', M_TD), 'with_front' => false],
]);
1
2
3
4
5
6
7
8

# Themosis way

PostType::make('slug-books', 'Books', 'Book')
->setArguments([
    'public' => true,
    'menu_position' => 20,
    'supports' => ['title', 'editor'],
    'rewrite' => false,
    'query_var' => false
])
->set();
1
2
3
4
5
6
7
8
9

# Where to create

Minotaure was configured to automatically load several folders.

├──minotaure-theme
|  ├──inc
|  |  ├──posttype
|  |  |  └── your-post-type-slug.php
1
2
3
4

# Post-type.json

WARNING

This feature does not be used anymore

# Params

taxonomy bolean,string Default: true. Add a taxonomy also used in the widget Events. false to disabled, string to a custom name
support array Add the basic support post type : title, editor, thumbnail, excerpt
fields bolean

ex:

"events": {
        "taxonomy": false,
        "support": [
            "title",
            "editor",
            "thumbnail",
            "excerpt"
        ],
        "fields": true
    },
1
2
3
4
5
6
7
8
9
10
Post type default taxonomy default support default fields
events type_events thumbnail start_date, end_date, start_time, end_time
partners type_partners thumbnail website
campaigns type_campaigns thumbnail start_date, end_date, start_time, end_time
projects type_projects thumbnail
testimonials type_testimonials thumbnail
team type_teams thumbnail
faq type_faqs thumbnail
Last Updated: 5/25/2020, 10:46:21 AM