title: Wordpress: add a class to a div using add_filter function
body: <p>I've previously used the <code>add_filter()</code> function to add a class to the body like so:</p>
  
  <pre><code>add_filter( 'body_class', 'add_custom_class' );
  function add_custom_class( $classes ) {
      if ( is_single() ) {
          $classes[] = 'post';
          }
      return $classes;
  }
  </code></pre>
  
  <p>I'd like to be able to use something along these lines to add a class to a div:</p>
  
  <pre><code>add_filter( 'div_class', 'add_custom_class' );
  function add_custom_class( $classes ) {
      if ( is_single() ) {
          $classes[] = 'post';
          }
      return $classes;
  }
  </code></pre>
  
  <p>or better still:</p>
  
  <pre><code>add_filter( 'div_class', 'add_custom_class' );
  function add_custom_class( $classes ) {
      if ( is_single() ) {
          $classes[] = 'post';
          }
      else if ( is_singular( 'custom-post-type' ) ) {
          $classes[] = 'custom-post-type-class';
          }
      return $classes;
  }
  </code></pre>
  
  <p>And then pull in the class in my theme like so:</p>
  
  <pre><code>&lt;div class="wrapper &lt;?php echo div_class(); ?&gt;"&gt;
  </code></pre>
  
  <p>Is this possible? Thanks in advance!</p>