Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1.  
  2. jQuery( '.single .td-post-content .wp-block-image > img' ).filter(function( index, element ) {
  3.  
  4. if ( -1 !== element.className.indexOf( 'wp-image' ) ) {
  5.  
  6. var $el = jQuery( element ),
  7. image = $el.context,
  8. image_src = image.src;
  9.  
  10. //add link and modal class on post image where the parent container is figure.wp-block-image
  11. if ($el.parent('.wp-block-image').length) {
  12. jQuery($el).wrap("<a href='" + image_src + "' class=''></a>");
  13. //we add the modal class on img because it is moved to the parent in tdModalPostImages
  14. $el.addClass( 'td-modal-image' );
  15. }
  16. }
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement