• Resolved dschitra

    (@dschitra)


    I am using 2012 wordpress theme, it supports transitional mode. I want to ask you that If i use advanced ad plugin to show amp ads into 2012 theme by pasting php shortcode into theme files. Is it possible?

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Thomas Maier

    (@webzunft)

    Hi dschitra,

    the question is if you have the AMP ad code in Advanced Ads or if Advanced Ads should convert your traditional ad codes into AMP.

    If you are using AdSense then check out this page.
    For general information on AMP ads see this page.

    If you use the basic plugin only and place the ad into your theme files either using the shortcode or PHP function then it would be used on AMP and non-AMP pages. This could create errors. You can use the advads_is_amp() conditional function to get a bit more control, like this:

    
    <?php
    if( function_exists( 'advads_is_amp' ) && advads_is_amp() ) {
    the_ad( AD_ID );
    };
    ?>
    

    The example above would include the ad in question only on AMP pages.

    I hope this helps.

    Thanks,
    Thomas

    Thread Starter dschitra

    (@dschitra)

    you meant there is no why to put amp ad code below header in free advanced version?

    Plugin Author Thomas Maier

    (@webzunft)

    That is not what I was trying to say. My reply above links to some more details about how to best handle it, especially when using add-ons, but it also gives you instructions on how to do it with the free version alone. Put the AMP ad code into an Advanced Ads ad and use the code above in your theme.

    Thomas

    Thread Starter dschitra

    (@dschitra)

    thanks for sharing knowledge!

    for example i have this php function got by advacned pluign <?php the_ad(25328); ? then what will the final code that i should paste into my theme file for showing amp ads of size 336×280?

    Plugin Author Thomas Maier

    (@webzunft)

    What ad type is this?

    If it is an image then it will work on AMP and non-AMP.

    If it is custom code that is written for non-AMP then it won’t show on AMP pages. If the code has the AMP format then it will show up.

    Advanced Ads does not alter the code automatically unless you are using AdSense and the Responsive add-on, which converts non-AMP into AMP automatically.

    Thanks,
    Thomas

    Thread Starter dschitra

    (@dschitra)

    adtype is plain text

    Plugin Author Thomas Maier

    (@webzunft)

    Thanks. The question is rather, if this is AMP-compatible code.

    You can just test it on an AMP page and see what happens. They will filter out invalid code automatically or show a warning in the backend. That should give you the chance to rewrite it then.

    Thread Starter dschitra

    (@dschitra)

    Thank you very very very much. I have done by your help. You are great. I am searching this for 1 a week. Its really admirable

    Plugin Author Thomas Maier

    (@webzunft)

    Thank you for your kind feedback. If you have a minute, I would really appreciate a positive review here.

    Thomas

    Thread Starter dschitra

    (@dschitra)

    Added

    Thread Starter dschitra

    (@dschitra)

    is there anyway to add this php function between the post instead of shortcodes [i.e [the_ads_1] for showing ads only on amp pages?

    Plugin Author Thomas Maier

    (@webzunft)

    Hi dschitra,

    yes, you can use also a PHP function to place an ad.

    It looks like this:

    <?php the_ad( 1 ); ?>

    1 is only an example for the ad ID.

    Does that help?

    Best regards,
    Thomas

    Thread Starter dschitra

    (@dschitra)

    can i use this code for inserting an ad only on amp page in my posts body shorcodes `<?php
    if( function_exists( ‘advads_is_amp’ ) && advads_is_amp() ) {
    the_ad( AD_ID );
    };
    ?>`

    Plugin Author Thomas Maier

    (@webzunft)

    Yes, this code would check if you are on an AMP page and only then deliver the ad.

    It only works if the template file where you added it is used for AMP as well. This is the case with the “transitional” option of the AMP plugin. I just wanted to mention it.

    Thomas

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘AMP Ads Question’ is closed to new replies.