You are getting the color for one category (term is more appropriate though)
$the_category_id = $category[0]->cat_ID;
instead of checking the ID and Color for each term, that’s why it’s applying the same to all.
Try this (untested):
<?php
$categories = get_the_category();
$sep = '';
foreach ($categories as $cat) {
$the_category_id = $cat->term_id;
if(function_exists('rl_color')){
$rl_category_color = rl_color($the_category_id);
} else {
$rl_category_color="#000"; // maybe a default color?
}
echo $sep . '<a href="' . get_category_link($cat->term_id) . '" class="' . $cat->slug . '" title="View all posts in '. esc_attr($cat->name) . '" style="background-color:' . $rl_category_color . '">' . $cat->cat_name . '</a>';
$sep = ', ';
}
?>
Related Posts:
- Manually set global $post vars with an ID, in order to use template tags
- How to prevent a post from being deleted?
- Limit access to posts/pages by user roles
- Show Similar Post Titles ( Similar to Stack Exchange )
- How do I unlock a post programmatically?
- How to work with Syntax Highlighter Evolved?
- User-Specific Timezones? Hack? Plugin?
- Delete Post With No Traffic?
- jQuery plugin only in one page/post
- How To Ignore a Filter On Applying Filter the Content In a Function
- Share buttons on article footer
- How to create a Page alias in WordPress
- How to extract images of post and pages excluding header and logo image in wordpress?
- Dynamic HTML not displaying at respective place
- Fastest way to loop through all posts?
- How to filter content post only on save
- Tag link suggestion plugin
- Collaborative post submission [closed]
- Is there plugin to show recent posts from one website in the widget area of another?
- How use %like% in sql statement wordpress
- How to get 1 or 2 specific posts on top of my wordpress blog?
- With W3 Total Cache when I publish a post it does not appear in the homepage. Only if i purge all cache [closed]
- The problem with WordPress Importer
- Hiding posts – WP Hide Post not working
- submit posts by unregistered users in wordpress
- Any built-in function to associate a post to category through a plugin?
- Display post lists in 2nd paragraph
- Matching Chapters to a Custom posts [closed]
- WordPress display breadcrumbs using Yoast plugin [closed]
- Preg Match All doesn’t Allow echo first character for WordPress Taxonomy Tags
- Two problems on my WordPress installation [closed]
- Excerpts on category page
- How to pull email and name from Flamingo plugin
- Which widget to use for display category post with view more? [closed]
- External RSS feed to WordPress Portfolio
- Add category selection to custom post type (plugin)
- Is it possible to send blog posts via email to subscribers?
- Custom setup of wordpress comments that are displayed
- Is there any plugin which can paste a common content to my every post?
- Import Instagram post to WordPress blog post
- How to get all posts belongs to a user between a certain date
- wordpress content .php file in an iframe’s src in a wordpress post
- Making my plugin create a page?
- How can I automatically download all images from all imported posts, place them on my new host, and replace all the links
- Function added to hook “new_to_publish” not executing – custom plugin
- Creating an admin meta box to save post as pending
- Article content navigator in wordpress like mbaskool website
- Getting a list of the published posts
- If post exists in the database – each time goes on `else`
- Custom Template for wordpress cpt plugin
- How can i summerize posts or news automatically in word press site?
- Edit part of a post
- WordPress Stats Plugin: Display Post Views [closed]
- Method/Plugin/Hack to Start a Post with an Writing Outline?
- Oops! That page can’t be found
- Help to Create a Simple Plugin to make a post
- New posts are not showing up on my front page
- Is there a hook similar to “save_post” which only fires AFTER the post is completely published?
- Randomize post (and page) IDs on generation
- Moving all wordpress posts from 50 websites to another website
- Show post object of any page in frontend
- Trying to add a new feature in my wordpress website
- Powerpress upload a podcast without creating a post for it
- automatically set random featured image by category in wordpress on post
- add tags to wordpress post using REST API
- Prefix WordPress Taxonomy Tags With Hashtag Symbol Like Twitter
- How to make a page both “private” and “password protected”
- Failed to load resource: the server responded with a status of 500 () post.php
- How to upload PDF from Front-End and post automatically?
- How to wrap image tag into div for post only?
- How can I get the Post ID and Post Type within a Must Use Plugin?
- Get value from an input field and pass into update_meta_data as $meta_value
- Get content and send to 3rd party
- Is it possible to get a shortcode generated by a plugin, then, using a function, create a new post using that shortcode?
- Different email notifications (about pending posts) to different users
- How to display single arbitrary facebook post with a shortcode?
- Custom post type request switches to media request
- Ger posts from similar tags and categories
- How to Batch Upload .docx Files as Posts
- WordPress ultra slow if I click on posts?
- single.php fires more than once after clicking on any post to view with different post id each time
- Twitter List Tweets and Delicious Links as Posts
- Most visited posts
- How to make only selected posts appear on a selected wordpress page
- wp_update_post does not change post status from draft to publish, returns 1
- Static page with formatted post list
- How to block external download link access if visitor not referred from WP?
- Automatically put a menu on every post
- Preset categories in wordpress by GET-paremters [duplicate]
- Notifications Bar on home page only
- Distribute post content through several divs [closed]
- Does anyone have the Custom Post Permalinks plugin from John P. Bloch? [closed]
- hide particular category post from front page only [closed]
- Can i have limit posts on a specific category and automatically remove older ones?
- Redirect a specific User role not admins automatically to view the post that they just updated
- warning wp session
- How to add portfolio category post count in main navigation menu?
- What is the easiest way to create a custom field archive?
- This is a plugin code that supposed to add badge/label Infront of post title but i don’t understand why it is showing the code tags in frontend
- How to show custom post type in all post section?