• Hi guys,

    This was bought up back in this post, but there hasn’t been an answer yet so I’m bumping it here. Was an is_amp() php switch ever implemented? There are a few content items in my posts that I need to hide or modify when it’s an AMP page — a php switch like that would be the perfect way to do it.

    If it hasn’t been implemented yet, is it something that’s on the roadmap? If it has, can you let me know the syntax etc?

    Thanks,
    Dave

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Dave

    we have it done here so you can modify your content for AMP pages accordingly

    Also let me know if this solves your issue and if you have any other queries feel free to reach us out ??

    Regards
    AzMak

    Plugin Author Mohammed Kaludi

    (@mohammed_kaludi)

    Hey Dave ( @obilix99),

    Thank you for asking the question, I apologize as I missed your previous ticket.

    Yes, there is a function called is_amp_endpoint(), to check and the content will only load if the is_amp_endpoint() function is available.

    You can use this function the same way as other is_ functions in WordPress.

    Do let me know if you have any question.
    Mohammed Kaludi

    Thread Starter obilix99

    (@obilix99)

    Hi AzMark,

    Sorry, that doesn’t work for my situation. I’m inserting content (a newsletter signup form, in this case) at the end of every post via a plugin. I need to be able to check via php whether the post is being shown on an AMP page, so I can stop the signup form from being shown in that case.

    At the moment, it shows the signup and thankyou text on AMP pages, but the form itself is stripped out, so it’s very confusing for readers.

    Thread Starter obilix99

    (@obilix99)

    Hi Mohammed,

    That’s perfect, thanks! I’ll test it out today. ??

    Cheers,
    DAve

    Plugin Author Ahmed Kaludi

    (@ahmedkaludi)

    @obilix99
    If it works, then please share it with the Community, it will help us.

    Regards,
    Ahmed

    Thread Starter obilix99

    (@obilix99)

    Yup, it worked perfectly — thanks! I just put:
    <?php if ( !is_amp_endpoint() ) {
    above the newsletter code block, and
    <?php } ?>
    afterwards, to keep it from being displayed on AMP pages.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘is_amp() switch’ is closed to new replies.