Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   [SOLVED] Google Adsense (http://forum.bytesforall.com/showthread.php?t=7796)

paragone Jun 26, 2010 11:47 PM

[SOLVED] Google Adsense
 
How can I add Adsense to JUST my TAG Pages and Categories Pages?. I would like to place it above the fold and in the center. Thanks. Love the theme.

John

paragone Jun 27, 2010 12:22 AM

Also I would like to add it to the Homepage. I don't want it to show on the posts. I figured it that it needs to go into "The Loop" but it is coming up on my post pages and I don't want that.

Velma Jun 27, 2010 10:21 AM

Hmmm...my immediate thought is to create a new widget area there, but I'm not sure how to restrict it to certain pages like can be done with the left and right sidebars in the "Style and Configure Sidebars" area.

Velma

juggledad Jun 27, 2010 07:31 PM

Put it in the'Above the loop' area and wrap it in a php if statement. You can use the is_category() and is_tag() functions in the 'if'

paragone Jun 27, 2010 07:54 PM

Hey juggledad! I am a complete noob. I know nothing about PHP. How would that look?

juggledad Jun 28, 2010 11:28 AM

try this
HTML Code:

<?php if (is_category() or is_tag()) { adsense code here } ?>

paragone Jun 28, 2010 02:28 PM

Is this how it is suppose to look??

<?php if (is_category() or is_tag()) { <script type="text/javascript"><!--
google_ad_client = "pub-4544333633484176";
/* 728x90, created 6/20/10 */
google_ad_slot = "8303439851";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>} ?>

I keep getting this error: Parse error: syntax error, unexpected '<' in /home/paragone/public_html/wp-content/themes/atahualpa351/functions.php(532) : eval()'d code on line 7

I also would like to apply this code to my HOMEPAGE. So would I throw a "IF" statement in for that also? Thanks a million

John

juggledad Jun 28, 2010 03:19 PM

8you can't mix php and html without being very careful. put all the html in an echo 'code goes here';

paragone Jun 28, 2010 05:35 PM

I am lost "Echo"?? I googled it. Still at a lost. It's not coming up on my "Homepage" either. How is it exactly suppose to look?? The whole code. I would be willing to make a donation, if I can just send you my email and password. I will be here till hell freezes over when I figure it out.

juggledad Jun 29, 2010 05:22 AM

try this, it should display th ad on a category page, a tab pag and the home page but only the first of the home pages.

HTML Code:

<?php if (is_category() or is_tag() or (is_front_page() and (!is_paged())) { echo '<script type="text/javascript"><!--
google_ad_client = "pub-4544333633484176";
/* 728x90, created 6/20/10 */
google_ad_slot = "8303439851";
google_ad_width = 728;
google_ad_height = 90;
//-->

</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>'; } ?>


paragone Jun 30, 2010 12:08 AM

It keeps giving me this error. I am taking the EXACT code. Copy and Paste and it is still giving me a problem.And it is still showing on where I post my individual articles (On their own page) which I dont want ....

This is my site: http://paragonesystems.com/

This is where I DO NOT want the ads to come up. On individual posts like these: http://paragonesystems.com/top-flori...ctions-part-2/


Parse error: syntax error, unexpected '{' in /home/paragone/public_html/wp-content/themes/atahualpa351/functions.php(532) : eval()'d code on line 7

Thanks again for taking the time and really caring about helping me out. I really appreciate it. Thanks a million.

John

juggledad Jun 30, 2010 05:20 AM

oops, one extra open paren change '(!is_paged()))' to '!is_paged()))'

paragone Jun 30, 2010 11:47 PM

OOOOO YEEEAHHHHHH... Great job!! It finally worked. Thanks for the amazing support!!! :):):) Thanks for going above and beyond. Keep up the amaaaaazzziinnnggggg work!!!

John


All times are GMT -6. The time now is 02:20 AM.

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