Last active
June 5, 2019 13:35
-
-
Save dnshulga/a3209a87be80bbcc5d5e2b2540a2f7f5 to your computer and use it in GitHub Desktop.
Add a custom column from ACF field to taxonomy edit page
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
<?php | |
function custom_column_header( $columns ){ | |
$columns['image'] = 'Image'; | |
unset($columns['description']); | |
return $columns; | |
} | |
add_filter( "manage_edit-arts_cat_columns", 'custom_column_header', 10); | |
function custom_column_content( $value, $column_name, $term_id ){ | |
if ($column_name === 'image') { | |
$term = get_term($term_id); | |
$columns = '<img src="'.get_field('thumbnail', $term)['sizes']['medium'].'" width="100" alt=""/>'; | |
} | |
return $columns; | |
} | |
add_action( "manage_arts_cat_custom_column", 'custom_column_content', 10, 3); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment