EduardET

add caption to image module

Jan 18th, 2018
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2. ( function( $ ) {
  3.     $( document ).ready( function() {
  4.         var image = $( ".wpc-image-with-caption img" );
  5.         if ( image.length ) {
  6.             image.each( function() {
  7.                 var caption = $( this ).attr( 'title' );
  8.                 $( '<p class="wpc-image-caption">' + caption + '</a>' ).insertAfter( $( this ) );
  9.             } )
  10.         }
  11.     } );
  12. } )( jQuery );
  13. </script>
Advertisement
Add Comment
Please, Sign In to add comment