Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example WordPress custom post type and taxonomy definitions using Extended CPTs and Extended Taxos
register_extended_post_type(
'newsletter',
array(
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => 45,
'quick_edit' => false,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'admin_cols' => array(
'newsletter-image' => array(
'title' => 'Featured image',
'featured_image' => 'thumbnail',
'width' => '150'
),
'newsletter-sent' => array(
'title' => 'Sent',
'meta_key' => 'nfa-newsletter-sent',
'date_format' => true
),
'newsletter-recipients' => array(
'title' => 'Recipients',
'function' => array( $this, 'recipients_col' )
),
'newsletter-type' => array(
'title' => 'Type',
'taxonomy' => 'newsletter-type'
),
'newsletter-stats' => array(
'title' => 'Statistics',
'function' => array( $this, 'stats_col' )
)
),
'admin_filters' => array(
'newsletter_type' => array(
'title' => 'View by type',
'taxonomy' => 'newsletter-type'
)
)
)
);
register_extended_taxonomy(
'newsletter-type',
'newsletter',
array(
'hierarchical' => false,
'show_ui' => true,
'meta_box' => 'radio'
),
array(
'singular' => 'Type',
'plural' => 'Types',
'slug' => 'newsletter-type'
)
);
@lumpysimon

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment