How to create Background Category with Different Color in wordpress

Posted on

This time I will share a tutorial that can beautify your website that is How to create Background Category with Different Color in wordpress,This is a very easy tutorial because you only need to use echo system only.

First go to the post and checklist what category you want to show Here I will display “WordPress

Find this code in your wordpres theme

Find This Code on your own Thame:

<?php
if(has_term(‘WordPress‘, ‘category‘)){
echo ‘<li><a href=”/category/wordpress” style=”background:#e96767″>Wordpress</a></li>’;
}else{
} ?>

You see there is code like this right. (‘WordPress’, ‘category’), in WordPress it is the category you choose to color. And in Category it is Taxonomy, so if you use custom taxonomy yourself you just change the Category section with the taxonomy you make on your theme

To change the color Change the following color code with your own color code # e96767

The result Will be like this, to beautify please combine with your css

Enough for today thanksregards C-Studio

Leave a Reply

Your email address will not be published. Required fields are marked *