Slider Revolution WP
09.06.2016
Make sure your Custom Image Field returns the url of the image as opposed to an HTML image tag (this is automatic for most Custom Fields plugins).
For this example I’ve setup a custom field using the Types plugin, and the slug is “wpcf-my-image”.
Modify the “wpcf-my-image” part with your Custom Image Field’s name/slug.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
function custom_meta_image($media, $post_id) { /* Custom Field slug for your image */ $my_custom_meta_slug = 'wpcf-my-image'; /* *************************************** */ /* no need to modify any of the below code */ /* *************************************** */ $meta = get_post_meta($post_id); if(array_key_exists($my_custom_meta_slug, $meta)) { $meta_image = $meta[$my_custom_meta_slug]; if(!empty($meta_image)) $media['alternate-image'] = $meta_image[0]; } return $media; } add_filter('essgrid_modify_media_sources', 'custom_meta_image', 4, 2); |