+ Reply to Thread
Results 1 to 9 of 9

Thread: Adsense-PHP Wordpress Single Post

  1. #1
    Jordy3738's Avatar
    Jordy3738 is offline Supreme Babbler Jordy3738 is a reputable WB member and has over 100 reputation points Jordy3738 is a reputable WB member and has over 100 reputation points
    Join Date
    Mar 2008
    Location
    Fl
    Posts
    669

    Default Adsense-PHP Wordpress Single Post

    How can I add Adsense into a PHP template on my new Wordpress blogs "single post" code page? I would like for it to be just below the article title/heading.

    <?php get_header(); ?> <div class="hfeed"><?php the_post(); ?> <div id="post-<?php the_ID(); ?>" class="<?php blogtxt_post_class(); ?>"> <h2 class="entry-title"><?php the_title(); ?></h2> <div class="entry-content"><?php the_content('<span class="more-line">'.__('Continue Reading &raquo;', 'blogtxt').'</span>'); ?><?php link_pages('<div class="page-link">'.__('Pages: ', 'blogtxt'), "</div>\n", 'number'); ?> </div><!-- <?php trackback_rdf(); ?> --> </div><!-- .post --><?php

  2. #2
    TechieGuy's Avatar
    TechieGuy is offline Super Moderator TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points!
    Join Date
    Jul 2007
    Location
    Canada
    Site
    http://technicallyeasy.net
    Posts
    3,098

    Default

    I put my adsense code in its own DIV tag between:

    PHP Code:
    <div class="entry-content"
    and

    PHP Code:
    <?php the_content('<span class="more-line">;'.__('Continue Reading &raquo;''blogtxt').'</span>'); ?>
    tags.

    By doing this, my adsense appears just below my post titles.

  3. #3
    Jordy3738's Avatar
    Jordy3738 is offline Supreme Babbler Jordy3738 is a reputable WB member and has over 100 reputation points Jordy3738 is a reputable WB member and has over 100 reputation points
    Join Date
    Mar 2008
    Location
    Fl
    Posts
    669

    Default

    Hey Techiguy, thanks for the response.

    Below is what I inserted in the "single post" PHP where you suggested, but it only resulted in having a blank space where the ad should be.

    The Adsense ad is active. I tried in in a sidebar widget and it displayed fine.

    Any suggestions?

    <div style="float:right; padding-left:5px;">
    <script type="text/javascript"><!--
    google_ad_client = "xxxxxxxxxxxxx";
    /* 200x200, created 6/22/09 xxxxxxxxxx*/
    google_ad_slot = "xxxxxxxxxxxxxx";
    google_ad_width = 200;
    google_ad_height = 200;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </div>

  4. #4
    TechieGuy's Avatar
    TechieGuy is offline Super Moderator TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points!
    Join Date
    Jul 2007
    Location
    Canada
    Site
    http://technicallyeasy.net
    Posts
    3,098

    Default

    I have only had blank spaces when the ad was first created. After several minutes the ads began to show up. Do you have a page I can look at?

    I'll have to think about this some more.

  5. #5
    Jordy3738's Avatar
    Jordy3738 is offline Supreme Babbler Jordy3738 is a reputable WB member and has over 100 reputation points Jordy3738 is a reputable WB member and has over 100 reputation points
    Join Date
    Mar 2008
    Location
    Fl
    Posts
    669

    Default

    Yes, here's the temp practice page I am currently working with.

    http://goddevotions.com/2009/06/my-first-post/

  6. #6
    TechieGuy's Avatar
    TechieGuy is offline Super Moderator TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points!
    Join Date
    Jul 2007
    Location
    Canada
    Site
    http://technicallyeasy.net
    Posts
    3,098

    Default

    Is the adsense code currently in the page?

  7. #7
    Jordy3738's Avatar
    Jordy3738 is offline Supreme Babbler Jordy3738 is a reputable WB member and has over 100 reputation points Jordy3738 is a reputable WB member and has over 100 reputation points
    Join Date
    Mar 2008
    Location
    Fl
    Posts
    669

    Default

    I removed it but I just put it back in. I got it right this time. What was happening is the
    Adsense code was reformatted into one straight line when I pasted it. I had to find the places where the code lines needed breaks in relation to the ads original format.

    Why did the Adsense code transform into a straight line?

    How can I prevent that from happening next time?

  8. #8
    TechieGuy's Avatar
    TechieGuy is offline Super Moderator TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points! TechieGuy is an exceptional WB member with over 1,000 rep points!
    Join Date
    Jul 2007
    Location
    Canada
    Site
    http://technicallyeasy.net
    Posts
    3,098

    Default

    I couldn't tell you why the adsense code transformed into a straight line? Did you copy it directly from Google into your page?

    The only time I have seen code copied into a straight line was when I had the wrong formatting enabled when editing the code in a text editor. I believe is was accidentally set to Mac formatting instead of Windows.
    Last edited by TechieGuy; 06-24-2009 at 12:52 PM. Reason: Spelling mistake.

  9. #9
    Jordy3738's Avatar
    Jordy3738 is offline Supreme Babbler Jordy3738 is a reputable WB member and has over 100 reputation points Jordy3738 is a reputable WB member and has over 100 reputation points
    Join Date
    Mar 2008
    Location
    Fl
    Posts
    669

    Default

    No, I did not copy it directly into the page from Google. I created the div in Note Pad and placed the code between. I then copied it from note pad and pasted it into the Wordpress single post php code, in my Wordpress editor.

+ Reply to Thread

Posting Permissions

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