[wp-hackers] Change class in form of comment_form()

Otto otto at ottodestruct.com
Wed Sep 4 02:42:31 UTC 2013


On Tue, Sep 3, 2013 at 9:14 PM, Ryan McCue <lists at rotorised.com> wrote:
> Seems a little ridiculous to not be able to change the class though. I'm
> surprised that you can change the ID and not the class, I'd expect it to
> be the other way around.

You can change the ID in case you're using a system by which you put
more than one comment form on the page (ala P2 and similar). The ID
must be unique, so you can change it to be so if needed.

> Keep in mind that if you're using an existing framework, it might be a
> pain (without a CSS preprocessor at least) to style IDs rather than
> classes. It's also a little kludgy.

If the framework doesn't let you address document elements by ID, then
I'd say that's a rather strange framework indeed. What is so hard
about using #comment-form instead of .comment-form?

If you're referring to a specific element, then ID is the correct way
to do that. If you just want to refer to it by class for some reason,
well, then .comment-form works just fine.

My question is, in what realistic situation should you be changing the
HTML in order to achieve a targeting improvement via CSS? Remember
that you have control over the ID of the element in question, so it's
not a matter of not being able to target it directly if desired. CSS
should be changed to achieve stylistic changes, not the other way
around.

-Otto


More information about the wp-hackers mailing list