Wordpress and Webdesign Forum go41 » WordPress Code Snippets

Adsense Help

(18 posts) (3 voices)

Tags:

No tags yet.

  1. an add just below the navigation bar div id="navbar" using the full width of your site you put in header.php

    near the end of header.php you have something like:

    <div id="navbar" class="clearfloat">
    <ul id="page-bar" class="left clearfloat">
    <li><a href="<?php echo get_option('home'); ?>/">Home</a></li>
    <?php wp_list_pages('sort_column=menu_order&title_li='); ?>
    </ul>
    <?php include (TEMPLATEPATH . '/searchform.php'); ?>
    </div>
    ********PUT YOUR ADD CODE HERE
    </div>
    ********YOU MIGHT ALSO TRY THIS PLACE
    <div id="page" class="clearfloat">

    I would put the code into a new DIV, so you can give it a style in style.css, like this:

    <div id="adheader-lb">
    
    your add here, maybe an adsense link block
    google_ad_width = 728;
    google_ad_height = 15;
    
    </div>

    with this div id="adheader-lb" you can set some height, margin, border or background color in style.css, the following code would just center it in the width:

    #adheader-lb {
    margin: 0 auto;
    text-align: center;
    }

    Posted 11 months ago #
  2. sim_a1
    Member

    Well your advise worked..but as you can see that i already have 3 ads in single.php, and if i add one in header than there are 4 ads displayed per page..i just want this to be displayed in index not in single post.

    Hope you understand.Thanks for the help.

    Posted 11 months ago #
  3. to show an add only on 'home' (same as front-page) you put a conditional tag around the add, like:

    <?php if ( is_home() ) { // +++ Display on home only ?>
    <div id="adheader-lb">
    
    your add here, maybe an adsense link block
    
    </div>
    <?php } // +++ end home only ?>

    I only added one line above the code and one line below!!

    There are also adsense link blocks available, you can display up to three of them additionally!! I would try the 728x15 link block with 4 entries here and show on all pages. In my experience visitors arrive more on any other page, not so often in index.php.

    You still have no sitemap.xml (use a plugin) and no robots.txt (create one)!!

    Posted 11 months ago #

RSS feed for this topic

Reply

You must log in to post.

Join us! or log in (lost password?):