Skip to content

Instantly share code, notes, and snippets.

@MrJoshFisher
Created October 7, 2021 09:23
Show Gist options
  • Save MrJoshFisher/c7035c41ec08e2419c36bf5a2fe4070e to your computer and use it in GitHub Desktop.
Save MrJoshFisher/c7035c41ec08e2419c36bf5a2fe4070e to your computer and use it in GitHub Desktop.
[custom admin column]
add_filter('manage_<POSTTYPE>_posts_columns', function ($columns) {
return array_merge($columns, ['verified' => __('Verified', 'textdomain')]);
});
add_action('manage_<POSTTYPE>_posts_custom_column', function ($column_key, $post_id) {
if ($column_key == 'verified') {
$verified = get_post_meta($post_id, 'verified', true);
if ($verified) {
echo '<span style="color:green;">';
_e('Yes', 'textdomain');
echo '</span>';
} else {
echo '<span style="color:red;">';
_e('No', 'textdomain');
echo '</span>';
}
}
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment