Set application posts/posttypes.
<?php
return [
'application.posts.$name' => (boolean|string|array) $enable|$label|$config,
];
The most simplified registration, book
labels are auto generated as Book
and Books
.
<?php
return [
'application.posts.book' => true,
];
You can also pass in the singular label as a string.
<?php
return [
'application.posts.book' => 'Boook',
];
The standard custom posttype configuration can be passed in.
<?php
return [
'application.posts' => [
'book' => [
'one' => 'Book',
'many' => 'Books',
'supports' => [
'title', 'thumbnail', 'editor'
],
'has-archive' => true,
'hierarchical' => false,
'menu-position' => 10,
],
],
];
- To enable better consistency with Intervention, options with
-
will be convereted to_
for WordPress to consume.
<?php
return [
'application.posts' => [
'post' => false,
'attachment' => false,
],
];
- Removing a default posttype will also remove any relevant options from
wp-admin
.
Change options on an existing post type.
<?php
return [
'application.posts' => [
'post' => [
'one' => 'Book',
'many' => 'Books',
'supports' => [
'title', 'thumbnail', 'editor'
],
],
],
];
If you are only changing one option, consider using dot notation for a cleaner config.
<?php
return [
'application.posts.post.supports' => [
'title', 'thumbnail', 'editor'
],
];
- You can also use
posttypes
versus shorthandposts
.
<?php
return [
'application.posttypes.post.supports' => [
'title', 'thumbnail', 'editor'
],
];