Support » Themes and Templates » post_class() multiple values

  • jasonsweb

    (@jasonsweb)


    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

    (@jcastaneda)

    THEME COFFEE MONKEY

    You could try
    'custom-class' . "$var1" . "$var2"
    Worth a shot, right?

    jasonsweb

    (@jasonsweb)

    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.