Add Column In Backend Posts List
This one is for pages
function my_custom_pages_columns( $columns ) {
$columns['eu_page'] = 'EU Page';
return $columns;
}
add_filter( 'manage_pages_columns', 'my_custom_pages_columns' );
function custom_page_column_content( $column_name, $post_id ) {
if( $column_name == 'eu_page' ) {
$parents = get_post_ancestors( $post_id );
if (in_array(2996, $parents) || $post_id=="2996") {
echo "<div class='ib yes_eu_page'>EU</div>";
}
}
}
add_action( 'manage_pages_custom_column', 'custom_page_column_content', 10, 2 );
This one is for Users
add_filter('manage_users_columns', 'add_status_column');
add_filter('manage_users_custom_column', 'manage_status_column', 10, 3);
function add_status_column($columns) {
$columns['live_status'] = 'ID';
$columns['email_verified'] = 'Email Verified';
return $columns;
}
function manage_status_column($empty='', $column_name, $id) {
if( $column_name == 'live_status' ) {
return $id;
}
if( $column_name == 'email_verified' ) {
$added_meta = get_the_author_meta( 'added_meta', $id );
if ($added_meta['sm_confirmed_email_address'] != true) {
$return_data ='<div class="no_very">NO</div>';
}else{
$return_data ='<div class="yes_very">YES</div>';
}
return $return_data;
}
}