Support Forum
ah, so you want it in the first post and the last post... bit different, but glad you figured it out!
Visit Cruise Talk Central and Mr Papa's World
Mr Papa said
so go to your sp theme and the template directory... edit the file spTopicView.php... find this line of code:
sp_SectionEnd('', 'post');
after it, do something like:
if ($spThisPost->first_post_on_page || $spThisPost->last_post_on_page) {
# my adsense code here
}
I'm starting to think I'm just to dumb to use SP
I've tried all the examples given in all the adsense topics, including this one (with and without php tags) and all I get is a fatal error ...
MartiL said
I'm starting to think I'm just to dumb to use SP
I've tried all the examples given in all the adsense topics, including this one (with and without php tags) and all I get is a fatal error ...
Your adsense code probably looks something like this:
<script type="text/javascript"><!-- google_ad_client = "ca-pub-363700071xxxxxxx"; /* 468 */ google_ad_slot = "7759544xxxx"; google_ad_width = 468; google_ad_height = 60; //--> </script> <script type="text/javascript" src="http://pagead2.go
What you would do is echo it out like this.
echo '<script type="text/javascript"><!-- google_ad_client = "ca-pub-363700071xxxxxx"; /* 468 */ google_ad_slot = "7759544xxxx"; google_ad_width = 468; google_ad_height = 60; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>';
Make sure you use the ' single quote at the beginning and end and finish with the semicolon.
You could also create a function in your theme's spFunction.php file like this.
function spAdsense468() { echo '<center><script type="text/javascript"><!-- google_ad_client = "ca-pub-3637000718xxxxx"; /* 468 */ google_ad_slot = "7759544xxxx"; google_ad_width = 468; google_ad_height = 60; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></center>'; }
Then wherever you want to place your 468x60 ad use
spAdsense468();
You can create several adsense functions for any size ad and include in your spFunctions file to make it easier too.
Create one called spAdsense728() for 728x90 sizes or spAdsenseText() for text ads, etc. Then just put the function that uses the ad you want to show into wherever you want it.
1 Guest(s)