Skip to content

Instantly share code, notes, and snippets.

@jamiemitchell
Forked from eugenoprea/functions.php
Created April 7, 2013 07:24
Show Gist options
  • Save jamiemitchell/5329428 to your computer and use it in GitHub Desktop.
Save jamiemitchell/5329428 to your computer and use it in GitHub Desktop.
Add custom post class
// Add custom post class to posts in the "Featured" category
add_filter('post_class', 'eo_custom_post_class');
function eo_custom_post_class($classes)
{
$new_class = 'featured-post';
if (in_category('Featured'))
$classes[] = esc_attr(sanitize_html_class($new_class));
return $classes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment