Site logo

Archived topic

AMP problems

5 replies · Started by Sunil on January 10, 2021

Viewing posts 1–6 of 6

Hello

I've installed AMP plugin and your support plugin from github. The problem I see now is that the menu has an unwanted top border that needs to be removed. Moreover, the menu doesn't appear when the user scrolls up.

How can we fix this?

Hi there,

I am not seeing the menu border on my device, did you resolve that ?

Sticky Navigation won't work with AMP as it requires JS which AMP does not support.

Hello David

You checked the website when I switched off amp plugin to diagnose the issue. I'm not able to resolve it (example image - https://imgur.com/MEfkEhU .
I can work without sticky menu but is there a way to show search in the menu? Other plugins like AMPforWp show search on AMP (along with sticky menu too).

Is there a way you can add that? The search option?

Hi there,

That gap is being added by this Facebook code: https://www.screencast.com/t/91uEw4670

You may want to make it so that code is only inserted when AMP is off, or add it to the footer.

Our navigation search requires javascript, but you can always insert a regular search bar into the navigation on AMP using a Hook Element.

Thanks Tom

Can you provide me with the code for the hook element. And can you guide me how can I make it AMP specific. Couldn't find display rule for the same.

Hi there,

To make amp specific conditions, you can use is_amp_endpoint().

Example:

<?php
if (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()) {
    echo 'this is amp enabled'; // do stuff
}
?>

If you place this code inside a Hook element with hook set to generate_after_header, when the page is amp enabled, the text this is amp enabled will show under the header.

Now that said, you can try looking for navigation plugins that are known to work well with AMP enabled sites that have shortcodes.

You can then do something like this within a Hook Element:

<?php
if (function_exists( 'is_amp_endpoint' ) && is_amp_endpoint()) {
    echo do_shortcode( '[your navigation shortcode]' );
}
?>
This archived topic is closed to new replies.