-
Hello Basti, This question is actually not related to your theme. But I still wanted to ask. I understand if you don't answer. 😊 😇
I want to give a different color for each category. can i do this? can you give an example? For example, the news category will have a red badge, and the sports category badge will be blue. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Hi Ersin, this is a good question. You cannot change this by the function, but you can search for the category name inside the badges with jQuery and change classes of each of them. Make sure that code is inside the // Category badge colors
$('.badge:contains("News")').closest('.badge').removeClass('bg-primary-subtle text-primary-emphasis').addClass('text-bg-danger');
$('.badge:contains("Sports")').closest('.badge').removeClass('bg-primary-subtle text-primary-emphasis').addClass('text-bg-primary'); // if your primary color is blue Change classes as you want. Solved? |
Beta Was this translation helpful? Give feedback.
-
I've saved it here now. js/custom.js but it didn't work.
|
Beta Was this translation helpful? Give feedback.
-
I think the problem was me. currently worked. I cleared browser memory. I've tried a lot. I guess I should take a break :) Thank you very much Basti. You are great. enjoy your work. |
Beta Was this translation helpful? Give feedback.
-
I was going to ask the same question for tags :) but I saw that tags also work. Wonderful. 😍 😊 👍 🙋 Basti lastly, I would like to ask, should I do it separately for more than one category or tag in the same color? or is there another way? it didn't work that way. Should I do uppercase and lowercase letters separately?
|
Beta Was this translation helpful? Give feedback.
Hi Ersin,
this is a good question. You cannot change this by the function, but you can search for the category name inside the badges with jQuery and change classes of each of them. Make sure that code is inside the
jQuery(function ($) {
...});
wrapper in your child'scustom.js
.Change classes as you want.
Solved?