Hello @asrme
Thank you for the support topic, are you using Transitional Mode or Reader Mode?
If so the AMP plugin already adds a Link at the footer to view non-AMP version
Exit mobile version
You can also use the amp_is_request() function to determine between AMP and non-AMP version.
eg:
if ( function_exists( 'amp_is_request' ) && amp_is_request() ) {
?>
<div class="popup">You are viewing AMP version click on <a href="<?php echo get_permalink(); ?>">this</a> link to view non-AMP version</div>
<?php
}
Hope this helps!
Thread Starter
asrme
(@asrme)
Where to add this code? I want a popup to display message – you are viewing AMP version, switch to non-amp. I am using Transitional AMP.
-
This reply was modified 4 years, 9 months ago by
asrme.
Hello @asrme
you can use that code in the theme’s functions.php or in theme files (header.php, footer.php) where you want to display that message.
Also, you need to add CSS for that popup
if you are non-dev I will recommend using AMP Enhancer Plugin, which has the custom popup functionality.
We also have an issue open which would allow you to add a “Exit mobile version” link to the footer on AMP pages: https://github.com/ampproject/amp-wp/issues/5293
We currently only show this link when you have mobile redirection enabled.
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.