Created
October 8, 2018 07:47
-
-
Save MjHead/da97e1efcdc5c655642e787124ab70dd to your computer and use it in GitHub Desktop.
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
<?php | |
add_filter( 'manage_<your_post_type_slug>_posts_columns', 'jet_add_custom_admin_columns' ); | |
add_action( 'manage_<your_post_type_slug>_posts_custom_column', 'jet_render_custom_admin_columns', 10, 2 ); | |
function jet_add_custom_admin_columns( $columns ) { | |
$columns['jet_custom_column_1'] = __( 'Column name #1', 'text-domain' ); | |
$columns['jet_custom_column_2'] = __( 'Column name #2', 'text-domain' ); | |
return $columns; | |
} | |
function jet_render_custom_admin_columns( $column, $post_id ) { | |
switch ( $column ) { | |
case 'jet_custom_column_1': | |
echo get_post_meta( $post_id, 'your_meta_key', true ); | |
break; | |
case 'jet_custom_column_2': | |
echo get_post_meta( $post_id, 'your_meta_key', true ); | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment