/** * Get the term id for a given category * @param (Object) $category The category to get the term id for (not required) * @return (Int) The term id */ function hkb_get_term_id($category = null) { $term_id = 0; $term = hkb_get_term($category); if ($term) { //term id $term_id = $term->term_id; } return $term_id; }
/** * Get the category colour * @param (Object) $category The category (not required) * @return (String) The category colour */ function hkb_get_category_color($category = null) { $term = hkb_get_term($category); $term_meta = get_hkb_term_meta($term); $category_color = '#222'; if (is_array($term_meta) && array_key_exists('meta_color', $term_meta) && !empty($term_meta['meta_color'])) { $category_color = $term_meta['meta_color']; } return $category_color; }