Created
May 7, 2012 15:23
-
-
Save pippinsplugins/2628380 to your computer and use it in GitHub Desktop.
Adds the value of an ECPT meta field to the 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
function ecpt_meta_field_classes($classes) { | |
$meta_value = get_post_meta(get_the_ID(), 'ecpt_fieldname', true); | |
if($meta_value) { | |
$classes[] = $meta_value; | |
} | |
return $classes; | |
} | |
add_filter('post_class', 'ecpt_meta_field_classes'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment