Hi Team!
How can I make enfold display the “caption”-Field (or any other image field) beneath the image on a regular post? For example: http://www.teensmag.net/jobreport-tourismuskauffrau-mann/
The Caption-Field in the image-Library says “The Lost Traveler_martinak14-Flickr”. This should be displayed under the image (or in an overlay), as it complies with german copyright law.
Can you help?
Rolf
Hi Rolf,
Try adding this at the very end of your theme / child theme functions.php file:
function add_custom_script(){
if(is_singular('post')){
?>
<script>
(function($){
$(window).load(function() {
var postImage = $('.single-big .wp-post-image');
var imgAlt = postImage.attr('alt');
postImage.after("<div class='img_caption'>"+imgAlt+"</div>");
});
})(jQuery);
</script>
<?php
}
}
add_action('wp_footer', 'add_custom_script');
Regards,
Josue
Thanks, that works. Couldn’t you build that in as an option to enfold, so people don’t have to mess with their functions.php?
Hey Rolf!
Feel free to request it here. Also, if you use a child theme you can store functions like this in the child theme functions.php.
Best regards,
Josue