Title: Adding a class to post_class
Last modified: August 20, 2016

---

# Adding a class to post_class

 *  Resolved [ProbablyBest](https://wordpress.org/support/users/probablybest/)
 * (@probablybest)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/adding-a-class-to-post_class/)
 * Hey everyone,
 * I want to add a class of span4 to my article posts but there is a <?php post_class();?
   > there and I dont know how to add my own class of span4 to it.
 * My code for the article section is:
    `<article id="post-<?php the_ID(); ?>" <?
   php post_class(); ?> class="span4">`
 * I didn’t think the above would work but gave it ago. Does anyone know how to 
   add span4 just strictly to my article posts?
 * Thanks!
    Megan

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/adding-a-class-to-post_class/#post-2926640)
 * the Codex chapter for `post_class()` explains how:
 * [http://codex.wordpress.org/Function_Reference/post_class](http://codex.wordpress.org/Function_Reference/post_class)
   
   [http://codex.wordpress.org/Function_Reference/post_class#Adding_More_Classes](http://codex.wordpress.org/Function_Reference/post_class#Adding_More_Classes)
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [13 years, 10 months ago](https://wordpress.org/support/topic/adding-a-class-to-post_class/#post-2926643)
 * Try this instead:
 * `<article id="post-<?php the_ID(); ?>" <?php post_class('span4'); ?>>`
 *  Thread Starter [ProbablyBest](https://wordpress.org/support/users/probablybest/)
 * (@probablybest)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/adding-a-class-to-post_class/#post-2926677)
 * Thanks! Exactly what I needed 🙂

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

The topic ‘Adding a class to post_class’ is closed to new replies.

## Tags

 * [class](https://wordpress.org/support/topic-tag/class/)
 * [post](https://wordpress.org/support/topic-tag/post/)

 * 3 replies
 * 3 participants
 * Last reply from: [ProbablyBest](https://wordpress.org/support/users/probablybest/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/adding-a-class-to-post_class/#post-2926677)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
