[WP 2.1] Wordpress edit source to add adsense for a single post???

Discussion in 'WordPress' started by 123GoToAndPlay, Mar 7, 2006.

  1. #1
    Hi all,

    this is my first post on DG, lot of info already gathered thx for that.

    My question has to do with wordpress 2.1 and the single post. What I want to do is display adsense on each single post view. So not on my homepage, only on the a single post.

    I have created my own theme and edit the source, but as a intermediate php I guess it has to do with
    
    <?php while (have_posts()) : the_post(); ?>
    				
    			<div class="post" id="post-<?php the_ID(); ?>">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    				<small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
    				
    				<div class="entry">
    					<?php the_content('Read the rest of this entry &raquo;'); ?>
    				</div>
    		
    				<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
    			</div>
    	
    		<?php endwhile; ?>
    
    
    
    Code (markup):
    But how do I check if the loop just displays one single view???

    Hope you understand my question

    Grtz,
    keitai
     
    123GoToAndPlay, Mar 7, 2006 IP
  2. mincus

    mincus Peon

    Messages:
    63
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I use the wonderful Adsense-Deluxe Wordpress plugin to add Adsense to my individual posts.

    And I have updated the template that I use to display just one adsense ad between the first and second posts on my blog.
     
    mincus, Mar 7, 2006 IP
  3. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    tx mincus,

    I already use adsense-deluxe (great plugin). But I want to edit the_loop so I can add one adsense on each single post.
     
    123GoToAndPlay, Mar 7, 2006 IP
  4. mincus

    mincus Peon

    Messages:
    63
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Are you talking about the front page here?
     
    mincus, Mar 7, 2006 IP
  5. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    nope, just as soon as you hit the post-title and you get the single post view.
     
    123GoToAndPlay, Mar 7, 2006 IP
  6. Mister Tut

    Mister Tut Guest

    Messages:
    837
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Study the structure of a theme (Like Blix) that has a seperate include just for single page.

    Picking apart other themes is how I've learned everything I know about WP hacking.
     
    Mister Tut, Mar 7, 2006 IP
  7. 123GoToAndPlay

    123GoToAndPlay Peon

    Messages:
    669
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    ok guys I found the solution

    
    if(is_single()){
    echo "test google ad";
    }
    
    Code (markup):
    Like I said I know a bit or two php, it's just that WP has a lot of custom functions. Put this in the_loop and you see what I mean.
     
    123GoToAndPlay, Mar 8, 2006 IP