ap_get_category_image( integer $term_id, integer $height = 32 )
Description #
Return category image.
Parameters #
- $term_idinteger (Required) Category ID.
- $heightinteger (Optional) image height, without PX. Default value: 32
Source #
File: includes/taxo.php
function ap_get_category_image( $term_id, $height = 32 ) {
$option = get_term_meta( $term_id, 'ap_category', true );
$color = ! empty( $option['color'] ) ? ' background:' . $option['color'] . ';' : 'background:#333;';
$style = 'style="' . $color . 'height:' . $height . 'px;"';
if ( ! empty( $option['image']['id'] ) ) {
$image = wp_get_attachment_image( $option['image']['id'], array( 900, $height ) );
return $image;
}
return '<div class="ap-category-defimage" ' . $style . '></div>';
}
Expand full source code Collapse full source code View on GitHub: includes/taxo.php:247
Add your comment