Skip to content

Instantly share code, notes, and snippets.

@qwersk
Created July 7, 2017 10:37
Show Gist options
  • Save qwersk/9b62d63de6e9b65fd25ff2cbc65cb822 to your computer and use it in GitHub Desktop.
Save qwersk/9b62d63de6e9b65fd25ff2cbc65cb822 to your computer and use it in GitHub Desktop.
SHOW ACF FIELD IN ADMIN AREA #WP #WORDPRESS
function add_acf_columns ( $columns ) {
return array_merge ( $columns, array (
'location' => __ ( 'Location' ),
'price' => __ ( 'Price' )
) );
}
add_filter ( 'manage_course_posts_columns', 'add_acf_columns' );
function course_custom_column ( $column, $post_id ) {
switch ( $column ) {
case 'location':
echo get_post_meta ( $post_id, 'location', true );
break;
case 'price':
echo get_post_meta ( $post_id, 'price', true );
break;
}
}
add_action ( 'manage_course_posts_custom_column', 'course_custom_column', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment