Skip to content
Radicle
v1.3.2

Registering Post Types

The config/post-types.php file is used to register custom post types.

Radicle includes the Extended CPTs library along with a post types service provider to allow for configuring post types from a config.

By default, a seed post type is registered. Remove or replace this post type with one that works for your site.

All of the parameters from Extended CPTs are supported, and the example post type included in Radicle shows how to override the names used for the singular, plural, and slug.

Registering multiple post types

In config/post-types.php within the post_types array, add additional array keys to register multiple post types. In the example below, we are registering two post types: seed and product.

<?php

return [
    'post_types' => [
        'seed' => [
            'menu_icon' => 'dashicons-star-filled',
            'supports' => ['title', 'editor', 'author', 'revisions', 'thumbnail'],
            'show_in_rest' => true,
            'names' => [
                'singular' => 'Seed',
                'plural' => 'Seeds',
                'slug' => 'seeds',
            ]
        ],
        'product' => [
            'menu_icon' => 'dashicons-cart',
            'supports' => ['title', 'editor', 'author', 'revisions', 'thumbnail'],
            'show_in_rest' => true,
        ],
    ],
];

Last updated

Support Roots

Help us continue to build and maintain our open source projects. We’re a small team of independent developers and every little bit helps.

Sponsor Roots on GitHub