Last active
August 29, 2015 14:05
-
-
Save mathetos/d32dcbd4bfa5d4e6c796 to your computer and use it in GitHub Desktop.
Change image class if meta field available
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
<?php | |
add_filter('get_image_tag_class', 'add_imagelens_frames', 0, 4); | |
function add_imagelens_frames($classes, $id) { | |
$singlelens = get_post_meta( $id, '_enable_lens', true ); | |
if ($singlelens === 'imagelens-single') { | |
return $classes . ' ' . $singlelens; | |
} else { | |
return $classes; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment