Remove footer script on AMP for Twenty Twenty One
-
Hello,
Can we please add an AMP endpoint check for the footer script for twentytwentyone?
/** * Add script to fix anchor tag that toggle the burger menu. */ function twentig_twentyone_add_footer_script() { if ( twentig_is_amp_endpoint() ) { return; } ?> <script> (function() { document.addEventListener( 'click', function( event ) { if ( event.target.hash && event.target.hash.includes( '#' ) && ! document.getElementById( 'site-navigation' ).contains( event.target ) ) { var mobileButton = document.getElementById( 'primary-mobile-menu' ); twentytwentyoneToggleAriaExpanded( mobileButton ); } } ); })(); </script> <?php } add_action( 'wp_footer', 'twentig_twentyone_add_footer_script' );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Remove footer script on AMP for Twenty Twenty One’ is closed to new replies.