To add Google AdSense to your WordPress site without using a plugin, you can do so by manually inserting the AdSense ad code into your theme files. Here’s a step-by-step guide:
Table of Contents
ToggleCreate a Google AdSense Account
If you don’t already have one, sign up for a Google AdSense account and get your ad code from the AdSense dashboard.
Method 1: Add AdSense Code to WordPress Theme
Access your WordPress dashboard and navigate to Appearance > Theme Editor. Open the theme files (such as header.php, sidebar.php, or single.php) where you want to display the ads.
Insert AdSense Code
Copy the ad code provided by Google AdSense and paste it into the appropriate location within the theme file. For example, if you want to display ads in the sidebar, you would paste the ad code in the sidebar.php file.
Method 2: Using Ad Inserter Plugin
Install an Ad Inserter Plugin:
Search for an Ad Inserter Plugin in the WordPress plugin repository. One popular option is the “Ad Inserter” plugin. Install and activate the plugin.
Get AdSense Code:
Sign in to your Google AdSense account and create an ad unit. Copy the ad code provided by Google AdSense.
Configure the AdSense Plugin:
After installing the plugin, configure it according to the plugin’s settings. You will usually find settings to specify where you want the ads to appear, such as before content, after content, in the sidebar, or in the header.
Insert AdSense Code:
Paste the AdSense ad code into the appropriate location within the plugin’s settings or interface. Make sure to follow the plugin’s instructions for adding the code.
Save Changes and Preview
Save the changes to your theme file and then preview your website to ensure that the ads are displayed correctly.
Interesting Reads:
Performing An Accessibility Audit With An Accessibility Checker