WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The following bit of code results in a duplicate attribute site validation error.

This template script:

<div class="clearfix" <?php post_class() ?>>

produces this source output:

<div class="clearfix" class="post-263 post type-post status-publish format-st…

WordPress adds its own post-related classes to format the blog entry. Is there any way I can add my "clearfix" class to the template without producing the duplicate attributes?


share|improve this question
up vote 6 down vote accepted

Simple fix:

<div <?php post_class("clearfix"); ?>>

See post_class() for more details

share|improve this answer
Thank you, Brady! – user5486 May 19 '11 at 6:10
Your welcome. Don't forget to mark the answer as answered if this is the correct answer. – Brady May 24 '11 at 10:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.