Support » Plugin: AMP » Detect when the user sees the AMP version

  • Resolved ronaldlauweb

    (@ronaldlauweb)


    I’m using the Paired option.

    How can I do to detect if the user is viewing the AMP version?
    I would like to make some changes to the structure of the theme when loading AMP

    Regards,

Viewing 1 replies (of 1 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    @ronaldlauweb you use the is_amp_endpoint() function. For example, in your template if you want to serve an ad, you could do this:

    <?php if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) : ?>
        <amp-ad>...</amp-ad>
    <?php else : ?>
        <script>...</script>
    <?php endif; ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Detect when the user sees the AMP version’ is closed to new replies.