Read or change a show’s Content Calendar content types
Each show has its own list of content types. A type is { key, name, color, enabled, built_in, uses_content, content_limit }.
- Built-in keys, on every show:
tweet(content text, limit 280),truth(500),blog_post,newsletter,episode(the show’s real episodes, never entered by hand, never has content text) andother(each item names its own type). - A built-in type can be renamed, recolored and switched off, never removed. A podcaster’s own type has a
custom_…key, made from its first name and never changed. enabledfalse keeps the type’s items but leaves them out of the calendar and the items list, and out of the types an item may be given.content_limitis null for no limit.- A show that has never saved its list has the defaults.
Over REST. GET and PUT /benecaster-content-calendar/v1/shows/{show_id}/types need the same permission and per-show check as Read and write a show’s Content Calendar content items over REST. GET answers { items: [type] } in the show’s order. PUT sends { items }, every type in order:
- A type without a
keyis new, and every built-in key must be there. - A podcaster’s type left out is removed, unless an item or an idea still uses it (
400 benecaster_content_calendar_type_in_use). Ideas are covered in Read, write, rearrange and promote a show’s Content Calendar ideas over REST. - A refused row is
400 benecaster_content_calendar_invalid_types, withdata.index(the row) anddata.field:name(1–40 characters, unique per show ignoring case),color(#rrggbb) orcontent_limit(1–100,000).
The filter benecaster_content_calendar_content_types, ( array $types, int $show_id ): array, runs on every read of a show’s list: the Content Types panel, the item editor, labels, colors and the switched-off check. A return that is not an array is ignored. To run code when a list is saved, see Run your own code when a show’s Content Calendar content types are saved.
Code
<?php
// Offer a Podcast Clip type on every show that has not made its own.
add_filter( 'benecaster_content_calendar_content_types', function ( array $types, int $show_id ): array {
if ( ! in_array( 'custom_podcast_clip', array_column( $types, 'key' ), true ) ) {
$types[] = [ 'key' => 'custom_podcast_clip', 'name' => 'Podcast Clip', 'color' => '#db2777', 'enabled' => true, 'built_in' => false, 'uses_content' => true, 'content_limit' => 280 ];
}
return $types;
}, 10, 2 );
Hooks Used
Need this built rather than just documented? See our services →