Skip to content

Instantly share code, notes, and snippets.

@agustinprosperi
Last active December 23, 2015 09:33
Show Gist options
  • Save agustinprosperi/fb2440c8d8368a805109 to your computer and use it in GitHub Desktop.
Save agustinprosperi/fb2440c8d8368a805109 to your computer and use it in GitHub Desktop.
<?php
// add new column(s) to custom taxonomy list
add_filter('manage_edit-taconomyName_columns','manage_taconomyName_columns');
function manage_taconomyName_columns($columns){
foreach( $columns as $k=>$v )
$ke = $k;
array_pop( $columns );
return array_merge( $columns,
array( 'f_image'=>__('Image') ),
array( $ke=>$v )
);
}
add_filter ('manage_taconomyName_custom_column', 'manage_taconomyName_custom_fields', 10,3);
function manage_taconomyName_custom_fields($deprecated, $column_name, $term_id){
$prefix = 'cmb2_';
if ($column_name == 'f_image') {
$f_image = get_term_meta( $term_id, $prefix.'f_image', true );
echo '<img src="'.$f_image.'" alt="" height="50" />';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment