ThemeShaper Forums » Thematic

[closed]

How to add post-format classes to Thematic's body classes

(1 post)
  • Started 7 years ago by notlaura
  • This topic is not a support question
  1. I had a very hard time getting post formats to function in my child theme. Finally got them working thanks to my post on WPAnswers - I hope this helps anyone who is having the same/similar issues!

    In sum, it seems that the Thematic body class does not include the .format-$format selectors even when post formats have been enabled. I tried child_theme_override_post_class() to remove thematic_post_class but to no avail - although the post_class echoed instead of thematic_post_class and did contain the .format class, the style in the selectors was not read. So, the selector had to be manually added to post_class in functions.php like this:

    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' );

    From what I gathered, Twenty-Ten does it something like this which did not work for me:

    function my_add_format_support() {
        add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link', 'image') );
    }
    add_action('after_setup_theme', 'my_add_format_support', 11);

    Perhaps the .format class should be added to thematic_post_class? And @anyone more experienced than me, is there a better way to do this?

    Posted 7 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.