<script> jQuery(window).load(function(){ jQuery('a[href*="youtube.com/watch"]').magnificPopup({ type: 'iframe', iframe: { patterns: { youtube: { index: 'youtube.com', id: 'v=', src: '//www.youtube.com/embed/%id%?rel=0&autoplay=1' } } } }); }); </script>