How to place an Ad between Paragraphs in a WordPress Post

Intending to make ads look as a part of your content? Sidebar or above the title ads are not performing well for you? Well you should try out placing ads between paragraphs within your posts on a WordPress blog.

It will not only make them look like the part of your content but will also help in getting the most relevant advertisements for your readers which will probably increase your CTR. Let’s have a look at placing the ad first after which couple of guidelines will help you in optimizing them.

 Step 1: Access the files of your site theme via FTP or Dashboard area.

Note: through FTP you need to go to web or public_html > wp-content > Themes > Selected theme.

Step 2: Locate the file named Single.php

Step 3: Find the code

<!--?php the_content(); ?-->

 Note: If you are unable to find the code on Single.php look for it in other files through which Single.php is pulling the post content, you probably need to make the following change there. In some themes it has been observed it’s named as entry-content”.

Step 4: Replace the above mentioned code with the following:

$paragraphAfter= 1; //shows the ad after paragraph 1
$content = apply_filters('the_content', get_the_content());
$content = explode("</pre>
<pre>", $content);
for ($i = 0; $i
if ($i == $paragraphAfter) { ?>
<!-- END OF AD CODE -->
echo $content[$i] . "</pre>
} ?>

Place your ad code where it’s mentioned in the red fonts within above code.

Note: if you wish to render the advertisement after second or third paragraph simply change the numeric value given in the 2nd row $paragraphAfter= 1; according to your desire.

Tips for optimizing your ads:

It actually depends on the theme you are using for your site but still what worked for me was textual ad format with almost same font size and colors. Try keeping the ad’s title color to same as of links color on your site; this will make your readers think as if you’re recommending them something to read. Make sure you shall not violate the terms of the ad network you are using or else it could get your account banned.

For more quality tips to optimizing your ads get subscribed to our newsletter and receive updates for free which can help you in many ways to get maximum out of efforts.

Previous articleEasily Share Large Files over the Internet
Next articleHow to set Limits on Failed Login Attempts in WordPress
I’m Hasan, by profession a Marketer currently working as Head of Digital Marketing at Allainet, Pakistan office. Frankly speaking I love what I do and consider myself to be one of the luckiest person on the earth. Well, I don't make millions of dollars from my sites to drive a fancy car neither became super famous yet. What I do have is a beautiful wife, two amazing daughters, a loving family, awesome friends and the line of work that makes me feel special.

Leave a Reply