Skip to content

Instantly share code, notes, and snippets.

@feliciaceballos
Last active April 25, 2016 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save feliciaceballos/ddc7604663d1f838bc5917aa283d4ec4 to your computer and use it in GitHub Desktop.
Save feliciaceballos/ddc7604663d1f838bc5917aa283d4ec4 to your computer and use it in GitHub Desktop.
Populate Custom Fields in Post List View
function populate_custom_fields_in_post_list_view ($column_name, $id ) {
global $post;
$email = get_post_meta( $post->ID, 'automaton_client_email', true);
switch ($column_name) {
case 'client_email':
echo email_template($email);
break;
case 'client_phone':
echo get_post_meta( $post->ID, 'automaton_client_phone', true);
break;
default:
break;
} // end switch
}
add_action( 'manage_posts_custom_column', 'populate_custom_fields_in_post_list_view', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment