• I want to add a CTA box below post content that directs readers to check out the non-AMP page for more info (which is not appearing on the AMP page because it’s in custom fields), much as the non-AMP URL appears at the very bottom of the page. What’s the code to return the non-AMP URL?

    I want to do something like this:

    ===
    Please see the non-AMP page for more info.
    ===

    What should the link be?

    Thanks.

    MaryAnn

    • This topic was modified 7 years, 4 months ago by mjohanson.
    • This topic was modified 7 years, 4 months ago by mjohanson.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor ampforwp

    (@ampforwp)

    Hey @mjohanson,

    Have you updated the plugin to the latest version?

    We have modified the View Non-AMP function so that it can be used at other places as well using the hooks.

    Check this tutorial for more info: https://ampforwp.com/tutorials/add-view-non-amp-things-header/

    Regards
    Marqas

    Thread Starter mjohanson

    (@mjohanson)

    I do have the latest version of the plugin, but I am not a programmer. As you saying that there’s no easy way to call the non-AMP URL? I thought perhaps this would do it:

    
    <a href="<?php echo esc_url( trailingslashit( $this->get( 'the_permalink()' ) ).'?nonamp=1'); ?>" rel="nofollow">
    

    But it doesn’t seem to work.

    Plugin Contributor ampforwp

    (@ampforwp)

    Hey @mjohanson,

    Just call this function where you want to add View Non-AMP link.
    Function name: ampforwp_view_nonamp

    Hope it helps, let me know your progress on it.

    Regards
    Marqas

    Thread Starter mjohanson

    (@mjohanson)

    I’m sorry, but I really am an absolute neophyte in PHP. I’m trying this:

    
    Click over to <?php echo '<a href="' . ampforwp_view_nonamp() . '" rel="nofollow">the non-AMP version</a>'; ?> of this page for much more!
    

    But it doesn’t work. Could you kindly provide the exact coding I need to use?

    Plugin Contributor ampforwp

    (@ampforwp)

    Hi @mjohanson,

    As there is a limitation of help here, can you contact us at [email protected]?

    I will test it and will give you the exact code.

    Regards
    Marqas

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘how to insert link to non-AMP URL’ is closed to new replies.