ap_get_category_icon( integer $term_id, string $attributes = '' )

Description #

Return category icon.

Parameters #

  • $term_id
    integer (Required) Term ID.
  • $attributes
    string (Optional) Custom attributes. Default value: ''

Source #

File: includes/taxo.php

function ap_get_category_icon( $term_id, $attributes = '' ) {
	$option = get_term_meta( $term_id, 'ap_category', true );
	$color  = ! empty( $option['color'] ) ? ' background:' . $option['color'] . ';' : '';

	$style = 'style="' . $color . $attributes . '"';

	if ( ! empty( $option['icon'] ) ) {
		return '<span class="ap-category-icon ' . $option['icon'] . '"' . $style . '></span>';
	}
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment