Title: post_class() multiple values
Last modified: August 20, 2016

---

# post_class() multiple values

 *  [jasonsweb](https://wordpress.org/support/users/jasonsweb/)
 * (@jasonsweb)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/post_class-multiple-values/)
 * Hi,
 * Is it possible to add two variables to the post_class()?
 * At the moment I’ve got this:
    `<?php post_class('custom-class ' . $var1 . $var2);?
   >`
 * So one custom class and two variables. This is working, but it’s putting the 
   two classes of the variables together, without a space…
    Example: `custom-class
   var1var2`
 * Is it possible to simply add a space?
    Thanks in advance!

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

 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [13 years, 6 months ago](https://wordpress.org/support/topic/post_class-multiple-values/#post-3161774)
 * You could try
    `'custom-class' . "$var1" . "$var2"` Worth a shot, right?
 *  Thread Starter [jasonsweb](https://wordpress.org/support/users/jasonsweb/)
 * (@jasonsweb)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/post_class-multiple-values/#post-3161777)
 * Thanks!
    Works like a charm. (I’ve added a space behind “var1 “).

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

The topic ‘post_class() multiple values’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [variables](https://wordpress.org/support/topic-tag/variables/)

 * 2 replies
 * 2 participants
 * Last reply from: [jasonsweb](https://wordpress.org/support/users/jasonsweb/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/post_class-multiple-values/#post-3161777)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
