These instructions show how to set up a number of Google Adsense ads with the default theme on a wordpress blog. These instructions were written to describe how AdSense ads were added to http://lorcancoyle.org/blog.
First you must sign up for Google AdSense.
Examples of Banner ads are shown here. These instructions will place the Google Ads at the bottom of the right sidebar.
Go to the location of your blog installation (mine is /var/www/lorcancoyle.org/blog).
cd /var/www/lorcancoyle.org/blog
Open the sidebar php document for the default theme.
nano wp-content/themes/default/sidebar.php
Now copy the sample code given to you by Google and add it to the end of sidebar.php (just before the final </ul>). This end of the document should now look like this (i have replaced sensitive information with <TEXT IN CAPITALS>):
... <?php /* start of adsense code */?> <li> <script type="text/javascript"><!-- google_ad_client = "pub-<CLIENT NUMBER>"; google_ad_width = 120; google_ad_height = 600; google_ad_format = "120x600_as"; google_ad_type = "text_image"; //<SOME DATE>: <URL LOCATION> google_ad_channel = "<CHANNEL NUMBER>"; //--></script> </li> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> <?php /*end of adsense code*/ ?> </ul> </div>
Examples of Banner ads are shown here. These instructions will place the Google Ads after the meta-data note on the entry and before the comments.
Go to the location of your blog installation (mine is /var/www/lorcancoyle.org/blog).
cd /var/www/lorcancoyle.org/blog
Open the single php document for the default theme.
nano wp-content/themes/default/single.php
Now copy the sample code given to you by Google and add it to the end of simple.php This end of the document should now look like this (i have replaced sensitive information with <TEXT IN CAPITALS>):
... <?php /* start of adsense code */?> <script type="text/javascript"><!-- google_ad_client = "pub-<CLIENT NUMBER>"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "text_image"; //<SOME DATE>: <URL LOCATION> google_ad_channel = "<CHANNEL NUMBER>"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> <?php /* end of adsense code */?> <?php comments_template(); ?> <?php endwhile; else: ?> <p>Sorry, no posts matched your criteria.</p> <?php endif; ?> </div> <?php get_footer(); ?>
~~DISCUSSION~~