Title: Differing PHP Output per-Category
Last modified: August 19, 2016

---

# Differing PHP Output per-Category

 *  [schmickers](https://wordpress.org/support/users/schmickers/)
 * (@schmickers)
 * [18 years ago](https://wordpress.org/support/topic/differing-php-output-per-category/)
 * Hi all, I have a question for all of the PHP gurus out there…
 * I have a template that I am developing and I want to be able to display posts
   belonging to certain categories slightly differently. For instance, just say 
   I have four categories – “quick”, “mobile”, “children”, “pets”. I want to display
   posts from the “quick” and “mobile” categories differently from the “children”
   and “pets” categories.
 * Initially I was working with CSS and a hack to enter the category names as class
   names for each post, which meant I could style them differently, but I have reached
   a point where I want to change the order of some elements – for instance, for
   some categories, I want to display the author name, posting date, and other metadata
   before the body of the post, and for others I want to display them after, which
   is beyond the ability of mere CSS.
 * It occurs to me that what I need is some sort of <?php if> statement, and then
   the use of some kind of string function to search the categories string for each
   post for the relevant category, but that is beyond my ability.
 * Can anyone provide me any pointers?

The topic ‘Differing PHP Output per-Category’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [schmickers](https://wordpress.org/support/users/schmickers/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/differing-php-output-per-category/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
