• I’ve been using the AMP plugin in reader mode for a while, and I’d like to switch to transitional or standard.

    I’m using a Twenty Seventeen child theme, and transitional mode works, but all ads are gone. I’m using a plugin (AdRotate Pro) for ads. I used to edit the Reader theme to insert the shortcodes, but it’s obviously not possible in other modes.

    Based on https://gist.github.com/westonruter/f49e5ec4b435801c6ce875eef394a2e4, I understand I can just modify my child theme with code detection AMP endpoints in relevant part of the files as follows:

    <?php if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
    
    /* AMP specific code here */
    adrotate_group(1);
    } else if {
    
    /* non-amp (desktop) code here */
    adrotate_group(2);
    
    endif; ?>

    If that the right way to go about it? I’m a bit confused about the “function twentynineteen_ganka_styles()” in the example. It does not seem to be related to amp.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter cnxsoft

    (@cnxsoft)

    I’ve been playing with another site of mine with the same child theme (jobs.cnx-software.com) by adding the following code to content.php:

    <?php if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
            /* AMP specific code here */
            echo "AMP page";
    } else {
            /* Desktop code here */
            echo "Desktop page";
    } ?>

    But it will always show “AMP page” even when accessing the website from a computer.

    Plugin Author Weston Ruter

    (@westonruter)

    When you are in Standard mode there is no non-AMP version, so desktop visitors are also served AMP pages so that they too get the speed benefits.

    If you want to have a non-AMP version served to desktop visitors, use Transitional mode.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Handlings Ads for Amp/Desktop Desktop’ is closed to new replies.