Site logo

Archived topic

GP Site Library's Menu and Search mobile features with AMP Conflict

9 replies · Started by Baventhiran on February 25, 2021

Viewing posts 1–10 of 10

Hi,

I have a problem with the mobile Menu & Search functions of the Tasty site import.

First, both became non-interactive features in mobile. I tried disabling all plugins (save the GP ones) and enabling one by one; found out that the official AMP plugin (By AMP Project Contributors) was the cause.

After disabling it, both features work in mobile. Then installed and activated GP's AMP plugin alongside the official AMP plugin. In mobile, only the Menu feature appears and works but the search feature is no longer visible.

Tried another AMP plugin (By Ahmed Kaludi, Mohammed Kaludi), both features work in mobile, but unlike the previous AMP plugin, for the site pages to be AMP enabled, each page URL requires the /amp at the end of each.

Is there a way for both Menu and search features to work in mobile with the official AMP plugin (alongside GP's AMP plugin)?

Site: https://life.skyferia.com

Hi there,

the navigation search requires JS which is why it doesn't work on Mobile.
You can include a standard WP Search field in the nav using this PHP Snippet:

add_action( 'generate_menu_bar_items', function() {
    echo '<div class="hide-on-desktop">' . get_search_form() . '</div>';
} );

Adding PHP: https://docs.generatepress.com/article/adding-php/

Hi David,

Thanks for your guidance. Tried the snippet but the outcome is as before.

Can you add the code to the site so i can take a look at whats going on ?

Thanks. The code is at the site (placed using Code Snippets).

That hook is only available in Flexbox version of the theme.

Can you go to Customizer > General and switch it from Float to Flexbox?

Hi Leo,

Thanks for the Flexbox guide, however, this is the outcome: Flexbox + AMP

I'm targeting for this with AMP (currently this happens with AMP plugins deactivated): Float/Flexbox + NO AMP

Hi there,

That sort of functionality (the icon only) requires javascript at this time, which isn't supported in AMP.

In AMP, you need to show the search field only, or you'd need some custom development to develop a CSS-only toggle for the button to turn into a search field.

We're working on AMP compatibility with our javascript features.

Hi Tom,

Ah, that explains it. I'll stick with that for now then, thanks.

No problem!

This archived topic is closed to new replies.