Add an Adsense banner to your wordpess site without plugin

  1. Start a FTP program and connect to your wordpress website
  2. Locate your funtions.php (wp-content\themes\theme_name\functions.php)
  3. Edit the file and put the following code in your functions.php file:
  4. function showads() {
    return '
    <script type="text/javascript"><!--
    google_ad_client = "ca-pub-3134535021136249";
    google_ad_slot = "3483719222";
    google_ad_width = 468; google_ad_height = 60;
    // -->
    </script>
    <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    ';}
    add_shortcode('banner', 'showads');
    
  5. Modify the client, slot, width and height values
  6. Safe the file and overwrite the current

Now you can use the [banner] tag in your post to publish the banner:

[banner]

Author: Thomas Faddegon

Do you like my posts and want to do something back? You can buy me a beer :)