Did you know that in wordpress you can have category based image tags that will allow you to have different images relevant to the specific categories? The method to do this is as follows:

1. Images must have the same name of the category .

2. To make it easier, the images must be of the same format and must be in the same director. You can further decorate them by using the same dimensions for all of them.

3. Edit the file: wp-includes/classes.php
Within the class Walker_Category, create a variable and assign the path or URL of the image, complete with HTML code

$ catimg = ‘< img src = ” urlofimage / ‘. $ cat_name . ‘. jpg ” > ‘;

4. Link the variable image with the link of the category (within the previous function ):

$ Link .= $ catimg . $ cat_name . ‘< / a > ‘;

If you want to display images related to the names of the categories, here’s the solution.

The steps are simple:

1) Create a directory in the root of your blog with the name imgCategories and upload images with extension gif , png or jpg. Images that are uploaded must have exactly the same name as the concerned category.

2) In the post where you want to display the images of the categories, insert the following code:

<? $ Cat = get_the_category () , $ cat = $ cat [ 0]; ? >

This solution only serves to show one image of a category.

To associate more than one image to a category you could use a different code in the index.php of your blog. Here is the code :

<?php if ( in_category(‘1’)) { ?>
<img class=”cat_tag” src=”<?php bloginfo(‘template_directory’);?>
/images/category_tags/general_image.jpg” />
<?php } ?>

These image tags when used on wordpress will make wordpress automatically assign a image tag based on the category whenever a new post is published.