How to Add Google AdSense Between Posts in WordPress

How to Add Google AdSense Between Posts in WordPress

Google AdSense is one of the most popular ways to monetize your website. AdSense ads pay based on cost-per-click (CPC). Each time a visitor to your WordPress blog clicks on an ad, you receive a fee.

adsense

If you’re using WordPress.org and are hosting your blog through a third party, add Google AdSense ads to your blog to earn money. After you establish a Google AdSense account and are approved, you can begin adding ads to your site. Although many people use sidebar ads, you can also position ads between posts on your blog.

Before you make changes to your WordPress editor screen HTML, it’s a good idea to copy the original code and paste it into Notepad or a similar text-editor program. That way, if something goes wrong, you can delete all the code from WordPress and replace it with the original code.

Enter HTML Code to Position AdSense Ads Between Posts

Add AdSense Between Posts in WordPress Step 1

To display Google AdSense image or text ads between your posts, log in to your WordPress Dashboard, go into your theme Editor screen in the Appearance section, and open the index.php file located in the right panel. Enter this code in the center window of your editor screen:

Position it directly above the code that says:

<?php $count = 1; ?>

(See the red circled locations in the accompanying image for clarity.)

You can change the number in the code from 1 (meaning the ad will appear beneath the first post on your blog) to any number you want in order to place the ad under the specific post on your blog where you want it to appear.

Enter the Google AdSense Code

Add AdSense Between Posts in WordPress Step 2

Open another browser window and log in to your Google AdSense account. Create the ad unit you want to appear between your posts on your blog and then copy that AdSense code provided by Google.

Return to your WordPress dashboard window and paste your code in the same position as it is shown in the red circle in the accompanying image. It appears immediately before the line of HTML code that includes the –end .entry– code.

Click the Update File button to save the changes.

View Your Blog

Add AdSense Between Posts in WordPress Step 3

View your blog to ensure the changes you made display the way you want them to. Note that a live ad might not appear immediately, but the position holder should be there right away. It can take Google a day or so to start displaying contextually relevant ads in a new ad unit.