-
-
Save nhatdong/af37e6eba6036d81987a to your computer and use it in GitHub Desktop.
Genesis - Custom Post Class
This file contains hidden or 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