Warning: Cannot modify header information - headers already sent by (output started at /home/n742ef5/public_html/forum/index.php:3) in /home/n742ef5/public_html/forum/wp-content/plugins/asgaros-forum/includes/forum-online.php on line 80

Warning: Cannot modify header information - headers already sent by (output started at /home/n742ef5/public_html/forum/index.php:3) in /home/n742ef5/public_html/forum/wp-content/plugins/asgaros-forum/includes/forum-unread.php on line 43

Warning: Cannot modify header information - headers already sent by (output started at /home/n742ef5/public_html/forum/index.php:3) in /home/n742ef5/public_html/forum/wp-content/plugins/asgaros-forum/includes/forum-unread.php on line 82
How to create a custom post type Step 3 – Sithtamil – My Notes

Forum

Please or Register to create posts and topics.

How to create a custom post type Step 3

Create column and pass the values

// column creation
function wpl_owt_cpt_custom_columns($columns) {

$columns = array(
"cb" => "<input type='checkbox'/>",
"title" => "Movie Title",
"pub_email" => "Publisher Email",
"pub_name" => "Publisher Name",
"date" => "Date"
);

return $columns;
}

add_action("manage_movie_posts_columns", "wpl_owt_cpt_custom_columns");

function wpl_owt_cpt_custom_columns_data($column, $post_id) {

switch ($column) {

case 'pub_email':
$publisher_email = get_post_meta($post_id, "wpl_producer_email", true);
echo $publisher_email;
break;
case 'pub_name':
$publisher_name = get_post_meta($post_id, "wpl_producer_name", true);
echo $publisher_name;
break;
}
}

add_action("manage_movie_posts_custom_column", "wpl_owt_cpt_custom_columns_data", 10, 2);