SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wordpress Template Tweak

    OK. I need to place an advertisement between the 2nd and 3rd posts on my main page. Right now I have this code in my loop. What should I change to make it do between the 2nd and 3rd post? Can I just do ad_shown==1 for the next one and then change the ad_show=1 to be ad_shown=ad_shown+1;.

    Thanks


    <?php if (!isset($ad_shown)) { ?>
    ADVERT HERE

    <?php
    $ad_shown = 1;
    }
    ?>

  2. #2
    SitePoint Addict
    Join Date
    Mar 2006
    Posts
    367
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dB02 View Post
    OK. I need to place an advertisement between the 2nd and 3rd posts on my main page. Right now I have this code in my loop. What should I change to make it do between the 2nd and 3rd post? Can I just do ad_shown==1 for the next one and then change the ad_show=1 to be ad_shown=ad_shown+1;.

    Thanks


    <?php if (!isset($ad_shown)) { ?>
    ADVERT HERE

    <?php
    $ad_shown = 1;
    }
    ?>
    you could just continue to piece it together:

    PHP Code:
    <?php 
    // Begin ads
    if (!isset($ad_shown)) { ?>
    <!-- ADVERT 1 HERE -->

    <?php 
        $ad_shown 
    1
    } elseif (
    $ad_shown == 1){ ?>
     <!-- ADVERT 2 HERE -->
    <?php
    $ad_shown
    ++;
    }
    // End ads
    ?>

  3. #3
    SitePoint Zealot
    Join Date
    May 2005
    Posts
    182
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •