How to Insert Ads into Upper Part of Post Content

I know there are a tons of wordpress plugins that help you to insert your ads (Google Adsense, AdBrite, Clicksor, Nuffnang, 7Search, or whatever ads or banner)  into your post content.

However, using  a lot of plugins will increase your server CPU load, as well as slowing down the site loading. If you’re using shared hosting platform, your blog may be blocked due to exceed CPU limit, unless you invest a powerful dedicated server.

So, in this post I’ll guide you on how to insert your ads into your upper part of post content by altering the theme’s source code. Not to worry, it’s very easy.

First, please login to your Administrator Control Panel –> Appearance –> Editor. On the right side of your editor, look for the content-single.php (default themes – twentyeleven, in my case).

Alternatively, you can login to your hosting control panel –> file manager –> look for the path /blog path/wp-content/themes/your current theme/content-single.php

In content-single.php, look for this line:

</header><!– .entry-header –>
<div class=”entry-content”>
<?php the_content(); ?>

And replace it with this new line:

</header><!– .entry-header –>

<div class=”entry-content”>
<div id=”content-upper-left”>Your Google Adsense, AdBrite, Clicksor, Nuffnang, 7Search, or whatever ads or banner here</div>
<?php the_content(); ?>

Now, look for the style.css in the editor, look for this line:

/* =Content
———————————————– */
#main

And add the following code:

#content-upper-left {float: left;margin-right: 5px;width: 300px;height: 250px;}

Then it will become:

/* =Content
———————————————– */
#main
#content-upper-left {float: left;margin-right: 5px;width: 300px;height: 250px;}

Now your ads will be present on the blog post content as the picture above.

Easy? Now I’ll guide you how to configurate the ads position. Look at configuration below:

float: left; ( left / right / center )

width: 300px;height: 250px; (depends on your ads size, my example here is 300×250)

Any question? Or anything to share? Don’t forget to leave your comment.

Today's Top Picks for Our Readers:

Leave your comment here: