888888.888888.88""Yb..dP"Yb..8888b..Yb..dP.88b.88....db....8b....d8.88..dP""b8..dP"Y8
88__...88__...88__dP.dP...Yb..8I..Yb.YbdP..88Yb88...dPYb...88b..d88.88.dP...`".`Ybo."
88""...88""...88"Yb..Yb...dP..8I..dY..8P...88.Y88..dP__Yb..88YbdP88.88.Yb......o.`Y8b
88.....888888.88..Yb..YbodP..8888Y"..dP....88..Y8.dP""""Yb.88.YY.88.88..YboodP.8bodP'


88b.88.888888.888888.Yb........dP.dP"Yb..88""Yb.88..dP
88Yb88.88__.....88....Yb..db..dP.dP...Yb.88__dP.88odP.
88.Y88.88"".....88.....YbdPYbdP..Yb...dP.88"Yb..88"Yb.
88..Y8.888888...88......YP..YP....YbodP..88..Yb.88..Yb

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.

Html 5 Gallery
Photo album html5?
6 comments
page 1305
Post Image The Easy Peasy Way
Permalink attachment to post wordpress?
26 comments
page 1065
Quick N Dirty Bookmark Navigation
Bookmark navigation?
no comment
page 127
Html 5 Gallery
Html5 photogallery?
6 comments
page 1305
Html 5 Gallery
Image gallery using html5?
6 comments
page 1305
Post Image The Easy Peasy Way
Wp get attachment caption?
26 comments
page 1065
Html 5 Gallery
Html5 image?
6 comments
page 1305
What Wordpress Workflow Needs
Wordpress workflow?
3 comments
page 1226
How To Add Sidebars To A Theme
Register more sidebars?
10 comments
page 1053
Html 5 Gallery
Html5 picture gallery?
6 comments
page 1305
Post Image The Easy Peasy Way
Postimagesmedium?
26 comments
page 1065
Post Image The Easy Peasy Way
Wp codex postimagesmedium?
26 comments
page 1065
Post Image The Easy Peasy Way
Wp postimages order?
26 comments
page 1065
Post Image The Easy Peasy Way
Wp postimages order?
26 comments
page 1065
Html 5 Gallery
Html 5 image gallery?
6 comments
page 1305
Post Image The Easy Peasy Way
Php post imagesmedium?
26 comments
page 1065
Fun With Sidebar Tabs Styling
Sidebar image interesting?
2 comments
page 336
Fun With Sidebar Tabs Styling
Styling tabs css?
2 comments
page 336
How To Add Sidebars To A Theme
Add widgetized footer in wordpress theme?
10 comments
page 1053
Post Image The Easy Peasy Way
Theimage wordpress?
26 comments
page 1065
Html 5 Gallery
Html5 image gallery?
6 comments
page 1305
Wordpress Vs Graffiti
Graffiti yb combined?
8 comments
page 95
Poll Daddy Reviewed
Polldaddy poll?
2 comments
page 42
Html 5 Gallery
Html5 gallery?
6 comments
page 1305
Html 5 Gallery
Html5 gallery?
6 comments
page 1305
Post Image The Easy Peasy Way
Wp display all post images?
26 comments
page 1065
Why I Ditched Disqus
Add wordpress comments to friendfeed?
5 comments
page 1175
Quick N Dirty Post Exclusion
Fitler theloop addfilter?
11 comments
page 124
Using Your Own Url Shortener
Constructor and link shortner?
4 comments
page 1190
My Experience Of Flexx
Flexx of genesis wp theme?
4 comments
page 1026
Html 5 Gallery
Html5?
6 comments
page 1305
Wordpress Chat
Tchat page wordpress?
3 comments
page 1308
Quick N Dirty Post Exclusion
Filter wordpress posts plugin?
11 comments
page 124
  1 query every 823 seconds, updated 1 seconds ago.
Sunday, 1am
 __
(__)
   `

 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

Friday, 11am
 __
(__)
   `

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

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

Friday, 10am
 __
(__)
   `

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

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

Thursday, 8pm
 __
(__)
   `

 Wordpress 2.8 para Abril de 2009 | aNieto2K

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

Thursday, 8am
 __
(__)
   `

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

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

Thursday, 8am
 __
(__)
   `

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

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

Friday, 3pm
 __
(__)
   `

 WordPress News Summary: WordCamps, WordPress Meetups, WordPress PowerPoint, FeedBurner and Flash Warnings « WordPress RSS

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

Friday, 2pm
 __
(__)
   `

 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.

Wednesday, 12pm
 __
(__)
   `

 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.

Tuesday, 4pm
 __
(__)
   `

 WordPress links week 7 – 2009 | WPStart.org – WordPress themes, plugins and news

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

Tuesday, 1am
 __
(__)
   `

 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.