Snippet: Add Parameters to all Youtube Lightbox Videos
add_action( 'wp_footer', function() { ?>
( function( $ ) {
'use strict';
// Get lightbox elements
var $lightboxLinks = $( '.wpex-lightbox' );
// Loop through all lightbox elements
$lightboxLinks.each( function() {
var $this = $( this ),
$href = $this.attr( 'href' );
// Alter youtube links
if ( $this.data( 'type' ) == 'iframe' && $href.indexOf( 'youtube' ) !== -1 ) {
$this.attr( 'href', $href + '?modestbranding=1' ); // Add parameters here
}
} );
} ) ( jQuery );
<?php } );
All PHP snippets should be added via child theme's functions.php file or via a plugin (we recommend WPCode)