This is the code from the example:
// Category option checked
if ($instance['stats_tag']['category']) {
$post_cat = get_the_category($popular->id);
$post_cat = (isset($post_cat[0]))
? '<a href="' . get_category_link($post_cat[0]->term_id) . '">' . $post_cat[0]->cat_name . '</a>'
: '';
if ($post_cat != '') {
$stats[] = '<span class="wpp-category">' . sprintf(__('under %s', 'wordpress-popular-posts'), $post_cat) . '</span>';
}
}
and the code that I need integrated into the one above is
<?php
$categories = get_the_category();
$separator = ' / ';
$output = '';
if($categories){
foreach($categories as $category) {
$rl_category_color = rl_color($category->cat_ID);
$output .= '<a href="'.get_category_link( $category->term_id ).'" style="color:'.$rl_category_color.';">'.$category->cat_name.'</a>'.$separator;
}
echo trim($output, $separator);
}
?>
I’m not a developer, I know only a little css, I’m smart but not that smart, what I got is
// Category option checked
if ($instance['stats_tag']['category']) {
$post_cat = get_the_category($popular->id);
$post_cat = (isset($post_cat[0]))
? '<a href="'.get_category_link($post_cat[0]->term_id).'"style="background-color:'.$rl_category_color.';">'.$post_cat[0]->cat_name.'</a>'
: '';
if ($post_cat != '') {
$stats[] = '<span class="wpp-category">' . sprintf(__('under %s', 'wordpress-popular-posts'), $post_cat) . '</span>';
}
}
For when you find a little time. Thank you in advance.