Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function colormag_colored_category() {
- global $post;
- $categories = get_the_category();
- $separator = ' ';
- $output = '';
- if ( $categories ) {
- $output .= '<div class="above-entry-meta"><span class="cat-links">';
- foreach ( $categories as $category ) {
- $color_code = colormag_category_color( get_cat_id( $category->cat_name ) );
- if ( ! empty( $color_code ) ) {
- $output .= '<a href="' . get_category_link( $category->term_id ) . '" style="background:' . colormag_category_color( get_cat_id( $category->cat_name ) ) . '" rel="category tag">' . $category->cat_name . '</a>' . $separator;
- } else {
- $output .= '<a href="' . get_category_link( $category->term_id ) . '" rel="category tag">' . $category->cat_name . '</a>' . $separator;
- }
- }
- $output .= '</span></div>';
- echo trim( $output, $separator );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement