• Hello Everyone. I’m currently using the code I found at https://www.tamba2.org.uk/wordpress/adsense/ to post ads within a certain number of post.

    I have statics ads… which is basically an image file on my server that links to a web address. I applied this method to the following theme file: index.php, archive.php, and single.php.

    This is a small task but I would like to make my work load a little lighter. Since all these pages are using the same images anyways, is there some way I can you may an include or something to the ad code from one central file whether it be .html, .txt, or .php?

    Here are the codes that I used from the website.
    The variable

    <?php
    $postnum = 1;
    $showadsense1 = 1;
    ?>

    The output

    <?php if ($postnum == $showadsense1) {
    echo '
    AD CODE HERE
    ';
    } ?>
    
    <?php $postnum++; ?>

    I’m thinking something like an include can be added somewhere in the second portion of the code. I’m not a php person at all. Any advice would be greatly appreaciated.

  • The topic ‘Generating ads after 1st post from external file’ is closed to new replies.