Support » Plugins » Adding items to specific posts only

  • I’m using the following code to post Adwords ads in my first two posts, and Amazon ads in the rest of them:

    <?php
    $postnum = 1;
    $showgoogle = 2;
    $showamazon = 3;
    ?>

    <?php if ($postnum <= $showgoogle) { ?>
    <?php adsense_deluxe_ads(‘Post’); ?>

    <?php } $postnum++; ?>

    <?php if ($postnum >= $showamazon) { ?>
    <?php wp_ozh_randomwords(‘ads’) ?>

    <?php } $postnum++; ?>

    This works just fine on my index page, but doesn’t work on the archive page. I’ve also tried several variations of the following code to add the Amazon ads starting with the third post on the archive page to no avail:

    if ($postnum > 2) {

    echo “
    <iframe src=\”http://rcm.amazon.com/e/cm?t=dem01-20&o=1&p=9&l=st1&mode=books&search=democrats&fc1=000000<1=_blank&lc1=507AA5&bg1=FFFFFF&f=ifr\” marginwidth=\”0\” marginheight=\”0\” width=\”180\” height=\”150\” border=\”0\” frameborder=\”0\” style=\”\” scrolling=\”no\”></iframe>”;

    } $postnum++; ?>

    Any help you can provide would be much appreciated.

  • The topic ‘Adding items to specific posts only’ is closed to new replies.