0

I was wondering if all wordpress theme have a similar class name for the content.. For example I know the class for post/content in the twenty ten and twenty eleven is

.entry-content

if not then how would I go about referring contents for all theme using jQuery?

e.g $j('.entry-content').css('color','red');

thanks

1
  • 1
    Perhaps a better question would be: what are you trying to do, that you need to target all post content? If your ultimate goal is to change the foreground color of all post content to red,you should edit your question to ask that question instead. Using jQuery is but one of many implementations to solve a given problem. Jun 15, 2012 at 13:52

3 Answers 3

3

There is no mandatory class name for posts. Many themes use the post_class() if that is needed but you cannot rely on it.

To change the output of the_content() add a filter to 'the_content'.

1

This is basically an attempt at marking up web content in hAtom or hNews (an extension of hAtom). The entry-content class doesn't get assigned to the whole post but only to the body text, without title (which is entry-title). So it isn't really a replacement for the_post_class() because that gets assigned to the whole post. But for entry-content to make sense, the article needs a class of hentry. So using the_post_class(), it would be the_post_class('hentry') to include this class in the output.

And it has a very practical use: this markup has been established as kind of a standard for all those web services crawling and reformatting content, like Instapaper, Readability, Pocket etc. All those services use hAtom markup to identify the correct portions of an article. See Readability's Article Publishing Guidelines for a full example.

0

You really can't tell.

If you're writing a plugin I'd say the safe way to go is to create an options page where the user can set the classname to use, and if none is set, use .entry-content

Your Answer

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

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