Last active
October 8, 2015 18:38
-
-
Save petenelson/3372747 to your computer and use it in GitHub Desktop.
WordPress: Add additional body classes based on the post meta
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
// extra body classes based on the post meta | |
add_filter('body_class','theme_body_class'); | |
function theme_body_class($classes) { | |
$body_classes = get_post_meta(get_the_id(), 'body-class'); | |
if (false !== $body_classes && count($body_classes) > 0) | |
$classes = array_merge($classes, $body_classes); | |
return $classes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment