Last active
October 22, 2016 21:53
-
-
Save mhmoudsami/a54647556be818f5e21046d4bda271c6 to your computer and use it in GitHub Desktop.
hide div in single post if post belongs to category ID
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_filter('body_class', 'hide_div_if_post_belongs_to_category'); | |
| function hide_div_if_post_belongs_to_category($classes) { | |
| if ( is_singular('post') ) | |
| { | |
| if (in_category($category_id , get_the_ID())) | |
| { | |
| $classes[] = 'hide-this-div'; | |
| } | |
| } | |
| return $classes; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment