I have created a custom post type. I also have added a meta box to my custom post type. What I want to do now is add my meta box as columns to my custom post table.
My Custom Post
add_action( 'init', 'create_post_type' );
// Create my custom post
function create_post_type() {
register_post_type( 'spark_stars',
array('labels' =>
array(
'name' => __( 'Stars' ),
'singular_name' => __( 'Star' )),
'public' => true,
'has_archive' => true,
'supports' => array( 'title', 'editor', 'thumbnail'),
)
);
}
add_action('add_meta_boxes','stars_meta_box');
// Create my meta box
function stars_meta_box(){
global $post;
add_meta_box('first_name_meta_box','First Name',
'first_name_meta_box_html','spark_stars','normal','default');
}
// Create meta box html
function first_name_meta_box_html(){
wp_nonce_field('first_name','first_name_meta_box_nonce');
$value = get_post_meta(get_the_ID(), 'first_name_meta_box_key', true ); ?>
<label>First Name: </label>
<input type="text" name="fname"
value="<?php echo esc_attr($value); ?>"/>
<?php {
add_action('manage_spark_stars_posts_columns',.....) // is this the function?
add_filter('manage_spark_stars_posts_columns',.....) // is this the function?
How can I get this meta box as a column in my custom post table and also how can I get the thumbnail of each post as a column in my custom post table?