• Resolved Milind More

    (@milindmore22)


    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)
  • Plugin Author Twentig

    (@twentig)

    Hi,

    Good catch, we’ll include it in the next release.
    Thanks for the feedback.

    Have a nice day,
    Tom

Viewing 1 replies (of 1 total)
  • The topic ‘Remove footer script on AMP for Twenty Twenty One’ is closed to new replies.