1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How To Edit Index.php So That An Advert Is Displayed In-Between Posts?

Discussion in 'WordPress' started by bad_bob00, Aug 21, 2008.

  1. #1
    Hi,

    I'm trying to edit my wordpress template (the index.php file) so that I can display an advertisement in between the first and second post. At the moment the advert is stuck just before the first post.

    Here is my code (with the advert in bold):

    Any idea how to move the advert so that it is displayed below the first post? Or perhaps at the end of the last post on the page?


    Thanks :)
     
    bad_bob00, Aug 21, 2008 IP
  2. Armaan143

    Armaan143 Well-Known Member

    Messages:
    1,273
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Armaan143, Aug 21, 2008 IP
  3. slayer

    slayer Well-Known Member

    Messages:
    1,926
    Likes Received:
    85
    Best Answers:
    0
    Trophy Points:
    165
    #3
    slayer, Aug 21, 2008 IP
    bad_bob00 likes this.
  4. Dodger

    Dodger Peon

    Messages:
    1,494
    Likes Received:
    60
    Best Answers:
    0
    Trophy Points:
    0
    #4
    To move to the end, revise your index.php to have the getad function follow the block of if/else code:

    <?php if($tn_mz_blog_style == TRUE){ ?>
    <?php include (TEMPLATEPATH . '/layouts/' .$tn_mz_blog_style. '.php'); ?>
    <?php } else { ?>
    <?php include (TEMPLATEPATH . 'layouts/mzine.php'); ?>
    <?php } ?>
    
    <?php echo getad('banner')?>
    
    Code (markup):
    To have it follow the first post only, will need to see layouts/mzine.php file I think. Not sure what the test is for ($tn_mz_blog_style) and what sets it, possible this file is served instead of mzine.php
     
    Dodger, Aug 21, 2008 IP
    bad_bob00 likes this.