Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Teil 2 des Codes für Defer video Loading
function democratic_defer_video_load() {
if ( is_single() ) {
<!-- Defer Videos for Performance -->
<script>function init(){var videoDefer=document.getElementsByTagName('iframe');for(var i=0;i<videoDefer.length;i++){if(videoDefer[i].getAttribute('data-src')){videoDefer[i].setAttribute('src',videoDefer[i].getAttribute('data-src'));}}}window.onload=init;</script>
<!-- END Defer Videos -->
add_action( 'wp_footer', 'democratic_defer_video_load');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment