Created
July 7, 2017 10:37
-
-
Save qwersk/9b62d63de6e9b65fd25ff2cbc65cb822 to your computer and use it in GitHub Desktop.
SHOW ACF FIELD IN ADMIN AREA #WP #WORDPRESS
This file contains 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
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