
---
title: "WordPress — How To Style The Posts On The Basis Of Category"
date: 2010-12-20
author: "Rachael Kurt"
featured_image: "https://www.converticacommerce.com/wp-content/uploads/2013/12/wordpress3.png"
categories:
  - name: "Support & Maintenance"
    url: "/category/support-maintenance.md"
---

# WordPress — How To Style The Posts On The Basis Of Category

![](https://www.converticacommerce.com/wp-content/uploads/2008/11/wordpress.png)Customizing WordPress and styling your weblog is the play of your imaginations. WordPress opens up the plethora of opportunity for making the customizations work out for you. Here is a quick tip for customizing different category in different style.

Copy the code given below to **functions.php** and create &amp; replace the stylesheets (stylesheet1, stylesheet2, stylesheet3) with your specific css filenames.

```
function custom_cat_style()
 {
 ?>
 <link rel="stylesheet" href="<?php bloginfo('template_url')?>/stylesheet1.css" type="text/css" media="screen,projection" />

 <?php
 if( in_category('1') )
 {
 ?>
 <link rel="stylesheet" href="<?php bloginfo('template_url')?>/stylesheet1.css" type="text/css" media="screen" />    

 <?php
 }
 elseif ( in_category ('2') )
 {
 ?>
 <link rel="stylesheet" href="<?php bloginfo('template_url')?>/stylesheet2.css" type="text/css" media="screen" />

 <?php
 }
 elseif ( in_category ('33') )
 {
 ?>
 <link rel="stylesheet" href="<?php bloginfo('template_url')?>/stylesheet3.css" type="text/css" media="screen" />
 <?php }    else {     ?>

 <?php
 }
 }

add_action('wp_head','custom_cat_style');
```