• Resolved madhu34

    (@madhu34)


    My site is broken in amp version and home page layout and font has changed. It’s style layout is different from desktop version. Using transition mode due to some incompatible plugins. I have suppressed those plugins. Tried many solutions, but couldn’t resolve it.

    Checked the site in Google AMP Test tool and it shows error as “CSS Syntax error in tag style AMP Custom” in AMP Pages.

    You are requested to please check and provide solution of this issue.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Milind More

    (@milindmore22)

    Hello @madhu34

    Thank you for reaching out to us, The Generate Press theme provides an AMP compatibility plugin to fix AMP issues, Please download and install it, the instructions are provided in their documentation

    Additionally, can you please suppress plugin perfmatters from AMP settings as this optimization is already taken care of by the AMP plugin, you can read more about plugin suppression from our documentation

    We hope this helps!

    Thread Starter madhu34

    (@madhu34)

    Thanks for your reply.

    Generatepress AMP plugin is already installed.

    Permatters plugin is also suppressed.

    Regards

    Plugin Support Milind More

    (@milindmore22)

    Hello @madhu34

    Can you please remove this custom CSS that has been added in header, it is breaking the AMP css styling.

    <style>img:is([sizes="auto" i], [sizes^="auto," i]) { contain-intrinsic-size: 3000px 1500px }</style>

    Plugin Support Milind More

    (@milindmore22)

    @madhu34 Can you please share your site health information using this form

    Thread Starter madhu34

    (@madhu34)

    @milindmore22 You are just great… You were absolutely spot on. The real problem was with the styling code – <style>img:is([sizes="auto" i], [sizes^="auto," i]) { contain-intrinsic-size: 3000px 1500px }</style>

    I googled it and found that this code was inserted in WP 6.7.1 and included in wp-includes/media.php. I commented this code in media.php, cleared the cache, and tested the amp site. The error is gone. I don’t know whether it’s the right way or not, but commenting on this code resolved the issue.

    I was struggling to sort out the breaking of my AMP site, but you identified it correctly. Thanks a lot once again for your prompt reply and for helping me resolve this issue. Thanks…

    Plugin Support Milind More

    (@milindmore22)

    Hello @madhu34

    Making changes in WordPress core files is not recommended, instead can you please use the following code snippet in your child themes functions.php or in a custom plugin.

    /**
     * Disable auto sizes for AMP.
     */
    function amp_disable_img_auto_sizes() {
    	if ( function_exists( 'amp_is_request' ) && amp_is_request() ) {
    		return false;
    	}
    }
    
    add_filter( 'wp_img_tag_add_auto_sizes', 'amp_disable_img_auto_sizes' );
    Plugin Support Milind More

    (@milindmore22)

    @madhu34 As we didn’t receive a response I’ll mark this as resolved. Feel free to open a new support topic if you require any further assistance.

    Thread Starter madhu34

    (@madhu34)

    @milindmore22 Thanks a lot for your prompt support and guidance for resolving the issue.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.