Skip to content

Instantly share code, notes, and snippets.

@kachi
Created March 10, 2012 16:48
Show Gist options
  • Save kachi/2012039 to your computer and use it in GitHub Desktop.
Save kachi/2012039 to your computer and use it in GitHub Desktop.
<?php
function has_thumb_class($classes) {
global $post;
if( has_post_thumbnail($post->ID) ) { $classes[] = 'foo'; }
return $classes;
}
add_filter('post_class', 'has_thumb_class');
?>
/*アイキャッチを持った記事の場合で、且つ、<?php post_class(); ?>を使った場合、そのclassにfooを追加*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment