February 9, 2009

In 2.7 WordPress added threaded comments with a neat little function that would output the comment code complete with loads of standard CSS classes, we also have post_class which outputs standard classes for post. In 2.8 the class-fest goes further with a new function: body_class.

Body class goes in the body tag of each web page and outputs classes depending on the type of page that is being viewed. At the moment it outputs the following classes (it should be obvious what each is for)

I guess there is still some cleaning up to do on this as there are a few missing options, but it looks to be comprehensive and should help with further standardising themes.

Despite the obvious value of this though something just doesn’t sit right with me about creating core functions to output classes. I can’t put my finger on why I don’t like it at the moment, but as the concept is clearly here to stay I guess it doesn’t really matter. Enjoy the new classes.



Wordpress title showing space?
no comment on page 1371

Wordpress fun?
one comment on page 1376

Live blogging plugin?
4 comments on page 1258

Wordpress 3 admin speed up?
4 comments on page 1321

Framework photoshop?
3 comments on page 296

Fun wp plugins?
one comment on page 1376

Habari vs wordpress?
12 comments on page 440

Wp tags vs categories?
12 comments on page 7

Wordpress rss seo?
one comment on page 1361

Photo albums html5?
6 comments on page 1305

Wordpress chat?
no comment on page 1308

Wordpress exif data?
12 comments on page 230

Css sidear tab?
2 comments on page 336

Wordpress theme html5 blueprint?
6 comments on page 1305

Wordpress shortcode in plugin?
no comment on page 236

Html 50 photo album?
6 comments on page 1305

Get the post attachement?
24 comments on page 1065

Wordpress plugin development 30?
one comment on page 1373

Wordpress plugin development 30?
one comment on page 1373

Disqus formatting?
7 comments on page 1175

Html5 photoalbum?
6 comments on page 1305

Html5 photoalbum?
6 comments on page 1305

Wordpress fun?
one comment on page 1376

Fun wordpress plugins?
one comment on page 1376

Url shortener ideas?
4 comments on page 1190

Url shortener ideas?
4 comments on page 1190

Html 5 photo gallery?
6 comments on page 1305

Multiple post navigation?
no comment on page 1147

Html5 photo galleries?
6 comments on page 1305

Adding images to a wordpress 3 post?
24 comments on page 1065

Html5 photo gallery code?
6 comments on page 1305

Wordpress multiple blog master?
one comment on page 1376

Wordpress 3 tableprefix?
2 comments on page 1374

Wordpress 3 tableprefix?
one comment on page 1376

Using wordpress as a framework?
2 comments on page 335

Single post image size?
24 comments on page 1065

Get featured image src wordpress?
24 comments on page 1065

Disqus wordpress mu?
7 comments on page 1175

Image gallery html 5?
6 comments on page 1305

Wordpress theimage?
24 comments on page 1065

Wpgetattachmentimagesrc size?
24 comments on page 1065
  every 1742s, 1s ago, in 0.03s.
 __
(__)
   `
 Jose

been adding the fuction from sandbox 1.6 to some custom themes, this kind of classes help so much :) great it's getting in wp2.8

 __
(__)
   `
 WordPress News Report: iPhone, Widgets API, WordCamps in Hong Kong and China, International WordPress.tv « WordPress RSS

[...] What a body! [...]

 __
(__)
   `
 Lorelle on WP: WordPress News Report: iPhone, Widgets API, WordCamps in Hong Kong and China, International WordPress.tv | Aslifm Blogu

[...] What a body! [...]

 __
(__)
   `
 Wordpress 2.8 para Abril de 2009 | aNieto2K

[...] otro tag para nuestros themes que especificar

 __
(__)
   `
 WordPress News Report: iPhone, Widgets API, WordCamps in Hong Kong and China, International WordPress.tv | WORDPRESS EXTENSIONS-PLUGINS-THEMES-TEMPLATES

[...] What a body! [...]

 __
(__)
   `
 WordPress News Report: iPhone, Widgets API, WordCamps in Hong Kong and China, International WordPress.tv « Lorelle on WordPress

[...] What a body! [...]

 __
(__)
   `
 WordPress News Summary: WordCamps, WordPress Meetups, WordPress PowerPoint, FeedBurner and Flash Warnings « WordPress RSS

[...] What a body! [...]

 __
(__)
   `
 Otto

The idea was taken more or less directly from the Sandbox themes, which did this sort of thing as well. I think it's a good idea on the whole, because it standardizes several common theme tricks and removes a lot of the need for custom PHP code in themes to, for example, style posts by specific authors differently. End users have a hard time dealing with PHP, but can usually cope with simple CSS styling.

 __
(__)
   `
 ovidiu

what about adding some of the features of this plugin: http://www.alistercameron.com/2007/01/04/wordpr... this plugin is brilliant in my opinion.

 __
(__)
   `
 WordPress links week 7 – 2009 | WPStart.org – WordPress themes, plugins and news

[...] What a body! [...]

 __
(__)
   `
 david

I've been thinking about the class stuff as well.

My basic feeling is this: I can think of a few tangible benefits–ease of styling being by far the most prominent–but no meaningful deficit. Perhaps I'm missing something, but until it's pointed out it me I won't complain.


0.01s