Add custom css for each post inside a category.
-
Hi all. I am developing a wordpress news theme. What I want to do is add custom color to each category. At the end of the category template I have the following code, which works fine. This code add custom colors for each category (When user create a category, it choose a background color – I added an extra field there)
<?php $category = get_queried_object(); $category_id = $category->term_id; $cat_data = get_option("category_$category_id"); if($cat_data['catBG']){ ?> <style> some css code </style> <?php }?>
So far so good, but for example, if a user click a news inside the Sports Category (which background is green), when in the news single section, the css code returns to default (which color is red). I want the green css, for the news (inside the spors category) as well.
I hope what I said it make sense.
Thanks in advance.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add custom css for each post inside a category.’ is closed to new replies.