-
-
Save jamiemitchell/5329428 to your computer and use it in GitHub Desktop.
Add custom post class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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