Created
March 20, 2019 09:26
-
-
Save MjHead/1025f912a981b2fd73acb2a4c1a13d59 to your computer and use it in GitHub Desktop.
Admin column callback example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Show formated date from post meta in admin columns | |
* | |
* $meta_key - custom field to get date from | |
* $format - date format | |
*/ | |
function jet_admin_column_date( $column, $post_id ) { | |
$meta_key = '_date'; | |
$format = 'F, j Y'; | |
$date = get_post_meta( $post_id, $meta_key, true ); | |
if ( ! $date ) { | |
return '--'; | |
} else { | |
return date_i18n( $format, $date ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, please may i know how to get the meta key in Callback column just like jet_engine_custom_cb_related_posts?
Example i would like to achieve like this
set custom callback as >>> my_custom_admin_callback::my_meta_key
Then i create function