1

I want to style a link depending on its ID, for instance, if the category ID is 2, then I want the link to be pink. My theme calls the category like this:

<?php if (in_array('categories', get_option('theme_postinfo2'))) { ?> <?php the_category(', ') ?>

I found a way to style specific categories in lists by adding:

li.cat-item-7 { ... }  /* category ID #7, etc */

to my stylesheet, however, I cannot find a way to do the same thing to links. What type of solutions are available? Please be detailed in your reply as my coding knowledge is limited.

0

the basic way is to

 #li.cat-item-7
    { color: red; }

Now, change '7' to the number you want, as many times as you want and 'red' to the color you want for that category like -

 #li.cat-item-2
    { color: pink; }

    #li.cat-item-8
    { color: green; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.