WordPress custom supports for custom post types

I’m just using register_post_type to generate my new post type ‘gcg_block’ and generate the ui menu in the admin page. Using add_post_type_support for ‘author’ gives me the column Author in my page (although not sortable). I want to add a column ‘Shortcode’ to this list and fill it with custom data. I believe I want to create a new support and register it with my post type but I’m unable to find where I could. Am I on the right track or should I be looking at taxonomies for this?

What I’m trying to make is similar to Contact Form 7 list where it displays the shortcode that can be copied to areas in wordpress.

add_action( 'init', 'GCG_init' );
// 
function GCG_init() {

  //Register custom post type and create menu
  register_post_type( 'gcg_block', array(
    'labels' => array(
        'name' => 'Generic Content',
        'singular_name' => 'Block' ),
    'public' => false,
    'show_ui' => true,
    'show_in_menu' => true,
    //'supports' => array( 
    //  'title',
    //  'author',
    //  'editor',)
  ));

  add_post_type_support( 'gcg_block', 'author' );
}

Leave a Comment