Title: Loop question
Last modified: August 19, 2016

---

# Loop question

 *  Resolved [Nith](https://wordpress.org/support/users/nith/)
 * (@nith)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/loop-question-2-2/)
 * Hi all,
 * I have a loop that displays the latest two posts from specific categories.
 * I want to be able to apply different html to a post if it is in category 3, if
   not I want the normal html to applied to the code.
 * I’m guessing an IF statement would be needed here inside the loop, but my PHP
   isn’t that great which is why i’m asking how it can be done.
 * Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/loop-question-2-2/#post-1410035)
 * See the example:
    [http://codex.wordpress.org/The_Loop#Style_Posts_From_Some_Category_Differently](http://codex.wordpress.org/The_Loop#Style_Posts_From_Some_Category_Differently)
 *  Thread Starter [Nith](https://wordpress.org/support/users/nith/)
 * (@nith)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/loop-question-2-2/#post-1410038)
 * Thanks for your quick reply.
 * Was exactly what I was looking for 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Loop question’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Nith](https://wordpress.org/support/users/nith/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/loop-question-2-2/#post-1410038)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
