Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
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. –  Chip Bennett Jun 15 '12 at 13:52

3 Answers 3

up vote 3 down vote accepted

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'.

share|improve this answer

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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

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.