Broken layout and the tag is filled with CSS rules
-
Hi,
I had raised an issue with the folks that support the Otter blocks plugin.
The correspondence with the support group is shown below the summary.
I can provide a test environment within a virtual machine.
Summary:
The original issue is “- AMP versions of pages “lost” formatting”. Please see the image file wordpress_issue_2024-12-03.jpg. https://www.garrigan.nyc/images/wordpress_issue_2024-12-03.jpg
Explanation of the original issue:
WordPress version 6.6.2 is the last version of WordPress in which my pages function properly with AMP.
After I upgrade WordPress, the formatting of the pages “break” as illustrated in the attached image file.
From the vendor:
@jimgarrigan Yes, you can forward this to the AMP theme team. You can also share your staging URL with them so they can analyze the <style amp-custom> and confirm the issue.
—
Thank you for the information. With your permission, may I forward this message to the AMP team?Soare-Robert-Daniel left a comment (Codeinwp/otter-blocks#2601)
@jimgarrigan, there were 2 issues.
- The usage of is_amp_endpoint() triggered the warning in the logs. This one we can easily fix.
- The missing styles aren’t actually missing. They’re grouped together in a way that causes a parsing issue, preventing the browser from fully processing the CSS.
The AMP groups all the CSS into a single <style amp-custom> element, like in the image below:
CleanShot.2025-06-06.at.15.08.29@2x.png (view on web)
Then the browser will parse it and compute like this:
CleanShot.2025-06-16.at.10.06.39@2x.png (view on web)
Note
Notice the source as amp-custom
On your instance, when I checked, the generated CSS contained some incorrect fragments, which caused certain CSS rules (both from Otter Blocks and Gutenberg) to be ignored. I extracted some of our CSS rules from the <style amp-custom> tag to test them separately, and they worked correctly. It’s still unclear whether the issue lies with the plugin itself or with the way AMP combines all the CSS.
If the page has a broken layout but the <style amp-custom> tag is filled with CSS rules, then the issue likely lies in how AMP has combined the CSS.
I am using the Neve Resume 2 starter site template.
Steps to reproduce the problem:
- Build a “web” server using either Apache or NGINX.
- Install WordPress version 6.6.2. (Note: I am using multisite.)
- Install and activate the following plugins: AMP, Image optimization service by Optimole, Otter – Page Builder Blocks & Extensions for Gutenberg, Starter Sites & Templates by Neve
- Install the following plugin: Hyve Lite
- Neve – Plugin/Theme:
- Network disable theme Twenty Twenty-Four
- Install Neve Theme, not activated
- Install Neve Pro Plugin
- Activate Neve Pro Plugin
- Install and Network Enable – Neve child theme
- For each site, import the Resume 2 starter site.
- From staging, appearance themes, activate the Neve Child
- Neve Child menu, starter sites,
- Resume 2
- Continue
- Select Image Optimization
- Import Website
- Skip and view site.
- Neve Child, Dashboard, Settings, Performance, Enable Local Fonts Hosting, Enable Emoji Removal, Enable Embed Removal, Enable Lazy Rendering
- Neve Child, Dashboard, Settings, Manage Modules, Disable Scroll to top
- Disable Stick to top – Neve Child, customize, Header, Header Top/Header Main
- Configure AMP via the wizard.
- Open Wizard
- Developer or technically savvy
- Transitional Mode
- Only the portfolio page will display properly without modifications in AMP.
- Upgrade WordPress
- The formatting for the AMP pages will be “broken”.
From my production site:
Jun 13 07:26:16 ip-XXX-XX-X-XX 2025/06/13 07:26:15 [error] 14471#14471: *181749 FastCGI sent in stderr: “on amp_is_available was called <strong>incorrectly</strong>.
amp_is_available()(oramp_is_request(), formerlyis_amp_endpoint()) was called too early and so it will not work properly. WordPress is currently doing therender_blockhook. Calling this function before thewpaction means it will not have access toWP_Queryand the queried object to determine if it is an AMP response, thus neither theamp_skip_post()filter nor the AMP enabled toggle will be considered. It appears the plugin with slugotter-blocksis responsible; please contact the author. Please see <a href=https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/>Debugging in WordPress</a> for more information. (This message was added in version 2.0.0.) in /usr/share/nginx/html/www/wp-includes/functions.php on line 6085; PHP message: PHP Notice: Function amp_is_available was called <strong>incorrectly</strong>.amp_is_available()(oramp_is_request(), formerlyis_amp_endpoint()) was called too early and so it will not work properly. WordPress is currently doing therender_blockhook. Calling this function before thewpaction means it will not have access toWP_Queryand the queried object to determine if it is an AMP response, thus neither theamp_skip_post()filter nor the AMP enabled toggle will be considered. It appears the plugin with slugotter-blocksis responsible; please contact the author. Please see <a href=https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/>Debugging in WordPress</a> for more information. (This message was added in version 2.0.0.) in /usr/share/nginx/html/www/wp-includes/functions.php on line 6085; PHP message: PHP Notice: Function amp_is_available was called <strong>incorrectly</strong>.amp_is_available()(oramp_is_request(), formerlyis_amp_endpoint()) was called too early and so it will not work properly. WordPress is currently doing the `render_block</p><p><strong>From:</strong> James Garrigan<br><strong>Sent:</strong> Monday, June 16, 2025 12:07 PM<br><strong>To:</strong> ‘Codeinwp/otter-blocks’ <a href=”mailto:reply+A2J6EFLYAIA2XJDZZN5ONWGGLQOIPEVBNHHLUPQUJU@reply.github.com”>reply+A2J6EFLYAIA2XJDZZN5ONWGGLQOIPEVBNHHLUPQUJU@reply.github.com</a><br><strong>Subject:</strong> RE: [Codeinwp/otter-blocks] Usage of deprecated
is_amp_endpoint()reported by AMP plugin (Issue #2601)</p><p>Thank you</p>
<p><strong>From:</strong> Soare Robert Daniel <a href=”mailto:notifications@github.com”>notifications@github.com</a><br><strong>Sent:</strong> Monday, June 16, 2025 11:43 AM<br><strong>To:</strong> Codeinwp/otter-blocks <a href=”mailto:otter-blocks@noreply.github.com”>otter-blocks@noreply.github.com</a><br><strong>Cc:</strong> James Garrigan <a href=”mailto:garrigan@hotmail.com”>garrigan@hotmail.com</a>; Mention <a href=”mailto:mention@noreply.github.com”>mention@noreply.github.com</a><br><strong>Subject:</strong> Re: [Codeinwp/otter-blocks] Usage of deprecated
is_amp_endpoint()reported by AMP plugin (Issue #2601)</p><p><img width=”20″ height=”20″ src=”blob:https://wordpress.org/89852c27-bc4f-467f-9fc1-9d62f4d22053″><strong>Soare-Robert-Daniel</strong> left a comment <a href=”https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FCodeinwp%2Fotter-blocks%2Fissues%2F2601%23issuecomment-2977136670&data=05%7C02%7C%7C598e49860a0543da012b08ddacec7bc7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638856853864362016%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=IDq3un9m1rLoYLmgTVtgYJut82ZP1%2FXSEDSxEgqOta0%3D&reserved=0″>(Codeinwp/otter-blocks#2601)</a></p>
<p><a href=”https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjimgarrigan&data=05%7C02%7C%7C598e49860a0543da012b08ddacec7bc7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638856853864387672%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=F8QuHAailkTxtO72L%2FMv9oLUix7mITTEcGAnElUbt9k%3D&reserved=0″>@jimgarrigan</a> Yes, you can forward this to the AMP theme team. You can also share your staging URL with them so they can analyze the <code><style amp-custom></code> and confirm the issue.</p>
<p>—<br>Reply to this email directly, <a href=”https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FCodeinwp%2Fotter-blocks%2Fissues%2F2601%23issuecomment-2977136670&data=05%7C02%7C%7C598e49860a0543da012b08ddacec7bc7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638856853864401969%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=n4f1dhSBlD7g3nnO6qtIgpBSD35Q5fMChhOBrvPR%2FsQ%3D&reserved=0″>view it on GitHub</a>, or <a href=”https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA2J6EFNOCJFDMBPOXCBL2DD3D3QYPAVCNFSM6AAAAAB6X56CU6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSNZXGEZTMNRXGA&data=05%7C02%7C%7C598e49860a0543da012b08ddacec7bc7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638856853864415380%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=avsZbfUaGlC5y2WsPArGGSjNu9l7lJdApm1B0%2BNEmhw%3D&reserved=0″>unsubscribe</a>.<br>You are receiving this because you were mentioned.Message ID: <<a href=”mailto:Codeinwp/otter-blocks/issues/2601/2977136670@github.com”>Codeinwp/otter-blocks/issues/2601/2977136670@github.com</a>></p>
<p><strong>From:</strong> James Garrigan<br><strong>Sent:</strong> Monday, June 16, 2025 9:04 AM<br><strong>To:</strong> ‘Codeinwp/otter-blocks’ <<a href=”mailto:reply+A2J6EFKAE3BQIIRWL3A24V6GLOTOREVBNHHLUPQUJU@reply.github.com”>reply+A2J6EFKAE3BQIIRWL3A24V6GLOTOREVBNHHLUPQUJU@reply.github.com</a>>; Codeinwp/otter-blocks <<a href=”mailto:otter-blocks@noreply.github.com”>otter-blocks@noreply.github.com</a>><br><strong>Cc:</strong> Mention <<a href=”mailto:mention@noreply.github.com”>mention@noreply.github.com</a>><br><strong>Subject:</strong> RE: [Codeinwp/otter-blocks] Usage of deprecated
is_amp_endpoint()reported by AMP plugin (Issue #2601)</p><p>Thank you for the information. With your permission, may I forward this message to the AMP team?</p>
<p><strong>From:</strong> Soare Robert Daniel <<a href=”mailto:notifications@github.com”>notifications@github.com</a>><br><strong>Sent:</strong> Monday, June 16, 2025 3:21 AM<br><strong>To:</strong> Codeinwp/otter-blocks <<a href=”mailto:otter-blocks@noreply.github.com”>otter-blocks@noreply.github.com</a>><br><strong>Cc:</strong> James Garrigan <<a href=”mailto:garrigan@hotmail.com”>garrigan@hotmail.com</a>>; Mention <<a href=”mailto:mention@noreply.github.com”>mention@noreply.github.com</a>><br><strong>Subject:</strong> Re: [Codeinwp/otter-blocks] Usage of deprecatedis_amp_endpoint()reported by AMP plugin (Issue #2601)Soare-Robert-Daniel left a comment (Codeinwp/otter-blocks#2601)
@jimgarrigan, there were 2 issues.
- The usage of
is_amp_endpoint()triggered the warning in the logs. This one we can easily fix. - The missing styles aren’t actually missing. They’re grouped together in a way that causes a parsing issue, preventing the browser from fully processing the CSS.
The AMP groups all the CSS into a single
<style amp-custom>element, like in the image below:CleanShot.2025-06-06.at.15.08.29@2x.png (view on web)
Then the browser will parse it and compute like this:
CleanShot.2025-06-16.at.10.06.39@2x.png (view on web)
Note
Notice the source as
amp-customOn your instance, when I checked, the generated CSS contained some incorrect fragments, which caused certain CSS rules (both from Otter Blocks and Gutenberg) to be ignored. I extracted some of our CSS rules from the
<style amp-custom>tag to test them separately, and they worked correctly. It’s still unclear whether the issue lies with the plugin itself or with the way AMP combines all the CSS.If the page has a broken layout but the
<style amp-custom>tag is filled with CSS rules, then the issue likely lies in how AMP has combined the CSS.—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: <Codeinwp/otter-blocks/issues/2601/2975380762@github.com>
The topic ‘Broken layout and the tag is filled with CSS rules’ is closed to new replies.