'tf_color', 'title' => __( 'Accent Color', 'themify' ), 'description' => '', 'type' => 'color', 'meta' => array( 'default' => null ), ), ); return array_merge( $fields, $new_fields ); } add_filter( 'themify_metabox/taxonomy/category/fields', 'themify_theme_game_category_fields', 10 ); /** * Add category styles for the posts * * @since 1.0.1 * @return array */ function themify_theme_game_category_styles() { global $themify; if ( $themify->hide_meta_category === 'yes' ) return; $terms = get_the_terms( get_the_id(), 'category' ); if ( is_wp_error( $terms ) || empty( $terms ) ) return $terms; $styles = ''; foreach ( $terms as $term ) { $color = get_term_meta( $term->term_id, 'tf_color', true ); if ( ! empty( $color ) ) { $styles .= '#post-' . get_the_id() . ' .post-category a.term-' . $term->slug . ' { background-color: ' . $color . '; }' . "\n"; } } if ( ! empty( $styles ) ) { printf( '', $styles ); } } add_action( 'themify_post_end', 'themify_theme_game_category_styles' );