1

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?

Thanks.

1 Answer 1

6

Simple fix:

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

See post_class() for more details

1
  • Your welcome. Don't forget to mark the answer as answered if this is the correct answer.
    – Scott
    May 24, 2011 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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