EduardET

add gallery image caption

Jan 31st, 2018
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. <script>
  2. (function($) {
  3.     $(document).ready(function() {
  4.         var galleryItem = $('.custom-gallery .et_pb_gallery_item .et_pb_gallery_image');
  5.         galleryItem.each(function(){
  6.             var img = $(this).find('img'),
  7.                 caption = img.attr('alt');
  8.             $('<p class="wpc-caption">'+caption+'</p>').insertAfter(img);
  9.         })
  10.     });
  11. })(jQuery);
  12. </script>
Advertisement
Add Comment
Please, Sign In to add comment