term_id, 'category_color', true );
$thumbnail_id = absint( get_term_meta( $term->term_id, 'thumbnail_id', true ) );
if ( $thumbnail_id ) {
$image = wp_get_attachment_thumb_url( $thumbnail_id );
} else {
$image = blogmarks_placeholder_img_src();
}
?>
|
|
|
|
__( 'Choose an image', 'blogmarks' ),
'btn_txt' => __( 'Use image', 'blogmarks' ),
'img' => esc_js( blogmarks_placeholder_img_src() ),
)
);
}
endif;
add_action( 'admin_enqueue_scripts', 'blogmarks_admin_post_cat_js' );
/*Show category image in admin column*/
if ( ! function_exists( 'blogmarks_post_cat_column_head' ) ) :
function blogmarks_post_cat_column_head( $columns ) {
$new_columns = array();
if ( isset( $columns['cb'] ) ) {
$new_columns['cb'] = $columns['cb'];
unset( $columns['cb'] );
}
$new_columns['thumb'] = __( 'Image', 'blogmarks' );
return array_merge( $new_columns, $columns );
}
endif;
add_filter( 'manage_edit-category_columns', 'blogmarks_post_cat_column_head' );
if ( ! function_exists( 'blogmarks_post_cat_column_body' ) ) :
function blogmarks_post_cat_column_body( $columns, $column, $id ) {
if ( 'thumb' == $column ) {
$thumbnail_id = get_term_meta( $id, 'thumbnail_id', true );
if ( $thumbnail_id ) {
$image = wp_get_attachment_thumb_url( $thumbnail_id );
} else {
$image = blogmarks_placeholder_img_src();
}
$image = str_replace( ' ', '%20', $image );
$columns .= '
';
}
return $columns;
}
endif;
add_filter( 'manage_category_custom_column', 'blogmarks_post_cat_column_body', 10, 3 );