Skip to content

Instantly share code, notes, and snippets.

@MjHead
Last active March 25, 2019 13:01
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 MjHead/1660d4d54f8a300a53fbae22ef18a2f5 to your computer and use it in GitHub Desktop.
Save MjHead/1660d4d54f8a300a53fbae22ef18a2f5 to your computer and use it in GitHub Desktop.
/**
* Show image by stored image ID
*
* $meta_key - custom field to get image from
* $size - image size to show
*/
function jet_admin_column_date( $column, $post_id ) {
$meta_key = '_image';
$image_id = get_post_meta( $post_id, $meta_key, true );
$size = 'thumbnail';
if ( ! $image_id ) {
return '--';
} else {
return wp_get_attachment_image( $image_id, $size );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment