Skip to content

Instantly share code, notes, and snippets.

@eugenoprea
Last active December 12, 2015 02:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save eugenoprea/4700232 to your computer and use it in GitHub Desktop.
Save eugenoprea/4700232 to your computer and use it in GitHub Desktop.
Genesis - 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