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.

Adsense between posts (Wordpress)

Discussion in 'Placement / Reviews / Examples' started by pilar, Oct 22, 2006.

Thread Status:
Not open for further replies.
  1. #1
    I am busy all day long to find out how i can place the ads between posts.

    I have found a good article here: http://www.problogger.net/archives/...dsense-strategically-between-posts/#more-2323

    But I cannot follow it because I have to add them at the index.php of my Wordpress. I don't know how i can find the index.php. I tried it through the control panel of Wordpress > manage > files and when i open 'main index template' I only see this code:
    <?php 
    /* Short and sweet */
    define('WP_USE_THEMES', true);
    require('./wp-blog-header.php');
    ?>
    Code (markup):
    I also have Adsense deluxe and i don't know where to place the code in the index.php

    Please advise me.

    Thanks in advance
     
    pilar, Oct 22, 2006 IP
  2. pilar

    pilar Peon

    Messages:
    863
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Like i said I also have Adsense deluxe plugin. Placing the ads in the posts are no problem, but placing the ads within the WordPress templates is a big problem because i don't know where to place it.

    Thanks
     
    pilar, Oct 22, 2006 IP
  3. pilar

    pilar Peon

    Messages:
    863
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I allready find out. It was my stupid fault. I had to look at the theme template index.php
     
    pilar, Oct 22, 2006 IP
  4. VincentChow

    VincentChow Peon

    Messages:
    442
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I've just do this weeks ago, and now I've forgotten the steps.
    But well, your index.php is actually in your themes directory.
    Go to http://www.yourblog.com/wp-admin/theme-editor.php

    Hope you will be able to figure it out. Some themes are too complicated for that.
    Good luck!
     
    VincentChow, Oct 22, 2006 IP
  5. pilar

    pilar Peon

    Messages:
    863
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thanks for reply!

    The code i have to enter is:
    // Set Counter to 1, First Post
    $counter = 1;
    if (have_posts()) :
       while (have_posts()) :
          $counter = $counter + 1;
          the_post();
          the_content();
          if(2 == $counter)
          {
             echo ‘Adsense code’;
          }
       endwhile;
    endif;
    Code (markup):
    and the code is showing in my index.php is:
    <?php if (have_posts()) : ?>
    
    			<?php while (have_posts()) : the_post(); ?>
    
    			<div class="post" id="post-<?php the_ID(); ?>">
    
    			<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
    
    			<div class="descr"><img src="<?php bloginfo('stylesheet_directory'); ?>/img/timeicon.gif" alt="" /> <?php the_time('F jS, Y') ?> by <img src="<?php bloginfo('stylesheet_directory'); ?>/img/author.gif" alt="" /> <?php the_author() ?> </div>
    
    				<div class="entry">
    
    			<?php the_content('Read the rest of this entry &raquo;'); ?>
    
    				</div>
    
    			<p class="info">Posted in <?php the_category(', ') ?> <strong>|</strong> <?php edit_post_link('Edit','','<strong>|</strong>'); ?> <img src="<?php bloginfo('stylesheet_directory'); ?>/img/comments.gif" alt="" /> <?php comments_popup_link('No Comments &raquo;', '1 Comment &raquo;', '% Comments &raquo;'); ?></p>
    
    			</div>
    
    			<?php comments_template(); ?>
    
    			<?php endwhile; ?>
    
    			<p align="center"><?php next_posts_link('&laquo; Previous Entries') ?> <?php previous_posts_link('Next Entries &raquo;') ?></p>
    
    			<?php else : ?>
    
    			<h2 align="center">Not Found</h2>
    
    			<p align="center">Sorry, but you are looking for something that isn't here.</p>
    
    			<?php endif; ?>
    Code (markup):
    So i have to puzzle a bit to get the code correctly, right? Not just copy and paste.

    please advise, thanks
     
    pilar, Oct 22, 2006 IP
  6. VincentChow

    VincentChow Peon

    Messages:
    442
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hello pilar,

    You might want to try the following index.php that I've inserted the code. Since I'm not good at this at all, and I'm not sure what theme you are using, this will not 100% work. Just replace the "adsense code" as your own AdSense code and try it. Remember to backup your previous index.php first, to avoid any accident.

    Sorry, if it didn't work.

     
    VincentChow, Oct 22, 2006 IP
  7. pilar

    pilar Peon

    Messages:
    863
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #7
    thanks, i will try it. But you don't have it on vincentchow.net?
     
    pilar, Oct 22, 2006 IP
  8. pilar

    pilar Peon

    Messages:
    863
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #8
    i have try it, but unfortunately it doesn´t show an adsense ad
     
    pilar, Oct 22, 2006 IP
  9. VincentChow

    VincentChow Peon

    Messages:
    442
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #9

    Sorry, I missed something just now. You might want to try again.
    I removed it on my blog - as it is not working very well. Almost 0 clicks from it daily. :p
    Just a waste of space. Maybe I have not enough traffic yet. Good luck!
     
    VincentChow, Oct 22, 2006 IP
    pilar likes this.
  10. pilar

    pilar Peon

    Messages:
    863
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Thanks, it is working now!
     
    pilar, Oct 22, 2006 IP
Thread Status:
Not open for further replies.