How to use widgets to display ads on any page

How to get Google AdSense and add it to your website

There are many ways to display adverts on your website and one method, and perhaps one of the most commonly used, is to place them in widgets. The WordPress text widget is perfect for the job.

WordPress provides many types of widgets and each performs a different function. They can display text, a login form, a list of recent articles, and so on.

Some widgets are provided with a basic WordPress installation and plugins that are installed can add more widgets that provide additional features and functions.

WordPress sidebar widgets

The way that widgets work depends on the theme used with WordPress. A theme that has a sidebar is perfect for Widgets and there are millions of websites that use this basic layout.

About two thirds of the page width holds the content and then a sidebar on the right (most people choose the right, but sidebars can be on the left), is used to display advertising content among other things.

The right-hand sidebar keeps ads out of the way of the main content so they do not irritate site visitors too much. It is easy to ignore them.

Ads that are inserted into the middle of the content, ads that pop up, and ads that fill the screen are slightly more effective in terms of generating money, but you risk annoying site visitors.

If you must have adverts, consider using the sidebar.

Theme based widgets

It is possible for a theme to use widgets in places other than the sidebar. For example, the theme used for this website has a Header area that can be used to place widgets.

The Header widget area comes above the content of the page and is perfect for a banner advert. A small banner at the top of the page is less irritating to visitors than ads in the content.

(One of the benefits of being a member is that most adverts are hidden, so you won’t see the banner ad or sidebar ads. Open an incognito or private browser window to see the ads.)

Ad-friendly themes

The theme controls everything that appears on the home page, on posts and pages, so when you choose a theme for your website, you should get one that is ad-friendly.

Look at the theme, test it if possible, and see whether there are any ways in which it supports advertising. If you can place a text widget, you can insert an ad.

Some themes provide extra widgets and these may be useful for placing adverts

Widgets from plugins

Widgets are not the only way to insert adverts into web pages on your WordPress website, so it is not the end of the world if the theme you are using is not particularly ad-friendly.

There are special advertising plugins that enable you to display adverts in a variety of ways. Some of these may involve widgets. Ad Inserter for example, provides widgets that you can place in the sidebar to show ads.

Let’s see how to insert adverts using widgets.

1 WordPress appearance options

Click Appearance in the sidebar and then click Widgets below.

There may be a dozen or more widgets available, depending on what plugins are installed. Find the Text widget.

The WordPress Text widget

2 Drag into position

Click and drag the text widget over to the right side of the page. The theme labels the parts of the page and there might be (depending on the theme), a header, sidebar or footer.

Drag the text widget and drop it where you want it. Here I have dropped one on the Header and as the third item in the Sidebar.

WordPress Text widget

3 Create the ad widget

Click the text widget to open it and it can be configured to display an advert.

WordPress Text widget

  1. You probably don’t want a title above the advert, so make sure the Title box is empty.
  2. Copy the ad code from Google AdSense, click in the Content box and press Ctrl+V (PC) or Command+V (Mac). This pastes in the code.
  3. WordPress should not mess with the code and it must appear exactly as it was pasted in. Clear this checkbox.
  4. This visibility button is not part of WordPress. It is added by a plugin. I use Jetpack, but there are other plugins that add widget visibility options.

4 Set the visibility

Jetpack (and some other plugins) enable you to create rules that determine whether a widget is shown on the website. Get this or another widget visibility plugin to get more control over the display of adverts.

WordPress widget display options using Jetpack

  1. Click the plus button to add a rule. Several can be added and this widget has three.
  2. Choose between Hide and Show. The widget can be hidden if certain conditions are met in the rules below, or it can be shown if conditions are met.
  3. Each rule takes the form of If Something Is True. Set one or more to control whether the widget appears.

My rules show three examples of how widget ads can be controlled.

I hide this widget if the user is logged in, so members see a clean page with no adverts to distract them. (You’re welcome!)

I also hide the widget if the page is a sponsored one. A Sponsored category was created and sponsored posts are added to it when they are created.

I also hide adverts on pages (but allow them on posts). WordPress lets you create pages and posts. An example of a page is the About page and it does not need adverts, so I hide this widget.

Action points

  • Choose a WordPress theme that has places for widgets, such as a sidebar, header or footer.
  • Drag text widgets to the places you want to display adverts.
  • Paste Google AdSense (or some other ad code) into the Widget Content box.
  • Set the visibility of the advert using a plugin like Jetpack.

 

Go: Courses Home Page


Affiliate links

Be the first to comment

Leave a Reply

Your email address will not be published.