jQuery(document).ready(function ($) { $('.post-thumbnail a').each(function () { var postLink = $(this).attr('href'); if (postLink.includes('youtube.com') || postLink.includes('vimeo.com')) { $(this).attr('href', postLink).attr('data-lightbox', 'video'); } }); });