Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery( '.single .td-post-content .wp-block-image > img' ).filter(function( index, element ) {
- if ( -1 !== element.className.indexOf( 'wp-image' ) ) {
- var $el = jQuery( element ),
- image = $el.context,
- image_src = image.src;
- //add link and modal class on post image where the parent container is figure.wp-block-image
- if ($el.parent('.wp-block-image').length) {
- jQuery($el).wrap("<a href='" + image_src + "' class=''></a>");
- //we add the modal class on img because it is moved to the parent in tdModalPostImages
- $el.addClass( 'td-modal-image' );
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement