Skip to content

Latest commit

 

History

History
130 lines (95 loc) · 2.25 KB

File metadata and controls

130 lines (95 loc) · 2.25 KB

application.posts

Set application posts/posttypes.

Options;

<?php

return [
    'application.posts.$name' => (boolean|string|array) $enable|$label|$config,
];

Examples;

Register

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.

Remove

<?php

return [
    'application.posts' => [
        'post' => false,
        'attachment' => false,
    ],
];
  • Removing a default posttype will also remove any relevant options from wp-admin.

Update

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'
    ],
];

Note;

  • You can also use posttypes versus shorthand posts.
<?php

return [
    'application.posttypes.post.supports' => [
        'title', 'thumbnail', 'editor'
    ],
];

Further Reading;

Bug?