Unleash Your Genius!

Unleash Your Genius!

Browse Quick Guides by Subject

Placing Ads in Your WordPress Blog
Share this with your friends

Want to make money with your blog? Putting ads on your WordPress blog is any easy way to do it. Fortunately, there are some simple ways to add advertisements to various areas of your blogs. Here’s how you do it.

Inserting Ads in Your Blog’s Sidebar

Inserting ad code into a text widget in your blog’s sidebar is a very easy way to publish ads on your blog.

Inserting ads in the sidebar.

Insert ads into text widgets in your blog’s sidebar.

Simply click the Widgets link in the Appearance section of your WordPress dashboard’s left menu to open the Widgets page, where you can click and drag a text widget to your blog’s sidebar. Simply paste the ad code from the advertiser into the text widget, and the ads should begin displaying.

Inserting Ads Between Blog Posts

Some bloggers like to put ads in between blog posts. This isn’t hard to do if you’re comfortable pasting code into your theme’s CSS files. One of the easiest ways to do it is simply inserting an ad immediately after a blog post.

Log in to your WordPress dashboard, and click the Editor link in the Appearance section of your dashboard left menu to open the Edit Themes page. Click the index.php file under the list of Templates on the right side of your screen to open the index.php file.

Inserting ads between blog posts.

Insert code into the index.php file to display ads between posts.

Locate the code in the file that says <php if (have _posts ()) : ?>, and place your cursor immediately before that code. Type the following code where your cursor is placed: <?php $count = 1; ?>

Identify which post you want your ad to follow.

Insert code into the index.php file to identify which post you want your ad to display after.

Once that code is added, you can paste the code for the ad you want to display into the index.php file. Locate the code that says <!-- end .entry --> in your index.php file.

Insert your ad code into your index.php file.

Insert your ad code into your theme’s index.php file.

Place your cursor immediately after that code, and paste the ad code in that position. Click the Update File button to save your changes. Ads will start to display below your first blog post.

Insert ads after a post.

You can insert ads after a post in your blog.

Some WordPress theme CSS files are structured differently from the example shown in this guide. If the code you need isn’t in your theme’s index.php file, it may be in a separate loop.php file. If your theme is not as clear as the one used in this example, contact the theme developer for help or try to use one of the plug-ins listed later in this chapter to position ads on your blog.

Insert Ads in Your Blog’s Header or Footer

The process of inserting ads into your blog’s header depends on the theme you’re using and how your header is laid out. Inserting ads in your blog’s footer is easier, particularly if your footer is widgetized. Alternately, you can use the WP Footer Ad plug-in to insert ads into your blog’s footer.

Inserting Ads in Blog Posts

You can insert ads into your blog posts by editing your post.php file in your WordPress CSS editor so ads always appear in the same location in all your blog posts. The spot where you insert your ad code varies depending on where you want ads to appear. For example, you can insert ads at the beginning of your posts, right aligned, left aligned, at the end of your posts, and so on. It’s up to you. Just remember that you don’t want ads to detract from the content in your posts and interrupt or damage the user experience on your blog.

Fortunately, a number of WordPress plug-ins can help you manage ads and place ads in a variety of locations on your blog. Here are a few plug-ins you can test to see if they offer the help you need for the ad program you participate in:

Remember, the WordPress Codex is an excellent resource to get answers to questions about editing theme files.

One note of warning: WordPress does have a few restrictions as to what kind of ads can be placed on their site, so be sure to check their support page before posting your ads. For more information on setting up your WordPress blog, check out our Quick Guides on Setting Up Your WordPress Blog Feed and How to Find and Hire a Designer for Your WordPress Blog. Good luck, and happy blogging!

From The Complete Idiot’s Guide to WordPress by Susan Gunelius