Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

[SOLVED] Add Adsense section targeting code to single.php


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old Nov 19, 2010, 06:02 AM
Stefan72
 
8 posts · Oct 2010
[SOLVED] Add Adsense section targeting code to single.php

Another thread on the forum mentioned adding the code immediately below to the index.php as there is no single.php

<?php if ( is_single() ) { ?>
YOUR CODE HERE
<?php } ?>

The code I need to add is

<!-- google_ad_section_start -->

<!-- google_ad_section_end -->

In the middle of Google's 2 lines of code I also need to have the code that relates to the entire content of each post. I am new to coding and know it should look something like the_content() but not sure exactly.

Can you tell me what code in its entirety I need to add to index.php and where exactly I should put it?

Thanks very much.

Last edited by Stefan72; Nov 19, 2010 at 06:06 AM.
  #2  
Old Nov 19, 2010, 06:17 AM
juggledad's Avatar
juggledad
 
21,705 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
What version of Atahualpa and WP?
You should add it in the option at ato->Style & edit CENTER COLUMN->Content ABOVE the LOOP
__________________
If you like my help, please consider donating. I am happy to provide greater detail on this and other topics if you hire me. Please send detailed support requests to me as a private message, thank you.
Juggledad | Forum Moderator/Support
  #3  
Old Nov 19, 2010, 06:33 AM
Stefan72
 
8 posts · Oct 2010
Thanks for your reply. I'm using Atahualpa 3.5.3 and WP 3.0.1

Do I add the code below the code that is currently showing in the above the loop box, or is there anywhere else I should be putting it?

Would you mind listing the exact code I should be adding? Would it be,

<?php if ( is_single() ) { ?>
<!-- google_ad_section_start -->
<?php the_content(); ?>
<!-- google_ad_section_end -->
<?php } ?>

Thanks again
  #4  
Old Nov 19, 2010, 07:26 AM
juggledad's Avatar
juggledad
 
21,705 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
HTML Code:
<?php if ( is_single() ) { ?>
<!-- google_ad_code -->
<?php } ?>
using this would only show the ad on a page that was a single post. Is that what you want?
__________________
If you like my help, please consider donating. I am happy to provide greater detail on this and other topics if you hire me. Please send detailed support requests to me as a private message, thank you.
Juggledad | Forum Moderator/Support
  #5  
Old Nov 19, 2010, 07:38 AM
Stefan72
 
8 posts · Oct 2010
Yes, I just want it in single posts, but I've already got the actual ad code embedded in specific posts, by copying it to the html view of the edit post screen in wordpress.

I'm told I just need this extra bit of coding, in theory to the single.php file, that tells google to focus adsense ads on the content of each post only, rather than all the text visible on any given page e.g. the site title, sidebars and so on.

Google's advice - see https://www.google.com/adsense/suppo...n&answer=23168 - suggests using the 2 bits of code like this, but where it says "This is the text of your webpage. Most of your content resides here," I'm not sure what you'd replace it with for Atahualpa.

<html><head><title>Section targeting</title></head>
<body>
<!-- google_ad_section_start -->

This is the text of your webpage. Most of your content resides here.

<!-- google_ad_section_end -->
</body>
</html>

Last edited by Stefan72; Nov 19, 2010 at 11:51 AM.
  #6  
Old Nov 19, 2010, 11:58 AM
Stefan72
 
8 posts · Oct 2010
Hi again,

Should I be putting this code as the last bit of code in the above the loop box?

<?php if ( is_single() ) { ?>
<!-- google_ad_section_start -->
<?php the_content(); ?>
<!-- google_ad_section_end -->
<?php } ?>

Is the <?php the_content(); ?> bit in the middle correct?

Thanks

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to put code in loop with instruction for single.php? annsworld Center area post/pages 5 Dec 1, 2012 09:52 PM
How to add PHP to the loop on multi- and single post pages only? Fux Center area post/pages 2 Jun 16, 2010 04:55 AM
Add code after post text but before the tags section Wonderbaum Post-Kicker, -Byline & -Footer 2 May 22, 2010 06:02 PM
How to add php code to a 'single' page JakeThePeg Center area post/pages 8 Mar 21, 2010 01:21 AM
Executing PHP Code in "HTML Inserts Header" Section twola Forum How-To 1 Sep 30, 2009 04:51 AM


All times are GMT -6. The time now is 06:09 AM.


Powered by vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.