WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having a very hard time implementing post formats in my Thematic child theme. I am able to add post format theme support and add content via the big conditional statement, but the .format-video, etc. selectors do not appear in the post class so I can' use them to style the formats.

According to some echoing tests, the selector appears as it should in post_class() but is nowhere to be found in thematic_post_class(). I tried removing thematic_post_class() to let post_class() function instead:

// remove thematic_post_class to include post format selector in post class
function childtheme_override_post_class() {
     remove_action('thematic_post_class','thematic_access', 9);
add_action('init', 'childtheme_override_post_class');

With this function, thematic_post_class() no longer echoes, but the theme is still not registering the format selectors. I saw in another post that the after_setup_theme action hook worked to enable formats in a Twenty-Ten child - tried this in my theme but it made no difference:

function wpfolio_add_format_support() {
    add_theme_support( 'post-formats', array( 'aside', 'gallery', 'video', 'link', 'image', 'quote') );
add_action('after_setup_theme', 'wpfolio_add_format_support', 11);`

Any ideas? Thanks in advance

share|improve this question
Your add_theme_support looks like it should work. Is it just the post_class filter you need to get working? – goldenapples Mar 24 '11 at 21:25
Sorry - missed your reply somehow. Yeah, the format selectors show up in post_class but the theme won't read any style – notlaura Apr 5 '11 at 17:17
What does "won't read any style" mean? I understood you got the .format-$postformat class added, so your problem is to the definition in your stylesheet is not read/processed? – kaiser Apr 11 '11 at 15:59
Yeah, exactly. If I override thematic_post_class the .format-$postformat class is there, but any style in .format-$postformat{} in the stylesheet is not read at all. – notlaura Apr 13 '11 at 0:57
Okay, so do do get post-format classes on your posts, right (in your HTML)? But when you try to style them, you aren't seeing your CSS styles? Can you give some example snippets of your HTML and CSS? – Dougal Campbell Apr 14 '11 at 14:40
up vote 1 down vote accepted

Okay, I'm going on the assumption that the real question is "how do I get Thematic to add the post-format to its body classes?"

Try this in your functions.php:

function my_thematic_post_format_class( $classes = array() ) {
  $format = get_post_format();
  if ( '' == $format )
    $format = 'standard';

  $classes[] = 'format-' . $format;

  return $classes;

add_filter( 'post_class', 'my_thematic_post_format_class' );

Don't override the thematic post class functions. Just add that filter, and you should be good.

share|improve this answer
Excellent!! Works like a charm. Thanks so much. Yea, I think I was making this more complicated than it needed to be... – notlaura Apr 20 '11 at 11:16

Your Answer


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.