Website Babble Webmaster Forums  


Go Back   Website Babble Webmaster Forums > Creating a Website > HTML, PHP, CSS, Javascript & Coding/Programming Topics

Your WB Notifications

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-23-2009, 05:45 AM
Jordy3738's Avatar
Supreme Babbler
 
Join Date: Mar 2008
Location: Fl
Posts: 570
Jordy3738 is a reputable WB member and has over 100 reputation pointsJordy3738 is a reputable WB member and has over 100 reputation points
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.

Quote:
<?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
Reply With Quote
  #2 (permalink)  
Old 06-23-2009, 06:00 AM
TechieGuy's Avatar
Super Moderator
 
Join Date: Jul 2007
Location: Canada
Posts: 2,751
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!
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.
Reply With Quote
  #3 (permalink)  
Old 06-23-2009, 09:29 AM
Jordy3738's Avatar
Supreme Babbler
 
Join Date: Mar 2008
Location: Fl
Posts: 570
Jordy3738 is a reputable WB member and has over 100 reputation pointsJordy3738 is a reputable WB member and has over 100 reputation points
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?

Quote:
<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>
Reply With Quote
  #4 (permalink)  
Old 06-23-2009, 10:11 AM
TechieGuy's Avatar
Super Moderator
 
Join Date: Jul 2007
Location: Canada
Posts: 2,751
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!
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.
Reply With Quote
  #5 (permalink)  
Old 06-23-2009, 03:22 PM
Jordy3738's Avatar
Supreme Babbler
 
Join Date: Mar 2008
Location: Fl
Posts: 570
Jordy3738 is a reputable WB member and has over 100 reputation pointsJordy3738 is a reputable WB member and has over 100 reputation points
Default

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

http://goddevotions.com/2009/06/my-first-post/
Reply With Quote
  #6 (permalink)  
Old 06-24-2009, 06:06 AM
TechieGuy's Avatar
Super Moderator
 
Join Date: Jul 2007
Location: Canada
Posts: 2,751
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!
Default

Is the adsense code currently in the page?
Reply With Quote
  #7 (permalink)  
Old 06-24-2009, 12:47 PM
Jordy3738's Avatar
Supreme Babbler
 
Join Date: Mar 2008
Location: Fl
Posts: 570
Jordy3738 is a reputable WB member and has over 100 reputation pointsJordy3738 is a reputable WB member and has over 100 reputation points
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?
Reply With Quote
  #8 (permalink)  
Old 06-24-2009, 12:52 PM
TechieGuy's Avatar
Super Moderator
 
Join Date: Jul 2007
Location: Canada
Posts: 2,751
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!
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.
Reply With Quote
  #9 (permalink)  
Old 06-24-2009, 02:08 PM
Jordy3738's Avatar
Supreme Babbler
 
Join Date: Mar 2008
Location: Fl
Posts: 570
Jordy3738 is a reputable WB member and has over 100 reputation pointsJordy3738 is a reputable WB member and has over 100 reputation points
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 With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -6. The time now is 07:22 AM.


 Subscribe to RSS

WB Sponsors

flash chat

Home Jobs Online

Search Engine Marketing

Paid Surveys

Web Design Newcastle



 Subscribe to the Website Babble Feeds

2 Create a Website Homepage | 2 Create a Website Blog


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0