LATEST >>

Welcome Here And Thanks For Visiting. Like Us On Facebook...

EXEIdeas – Let's Your Mind Rock » WordPress / WordPress Tricks » Show Ads In Middle Of All Post In WordPress Without Plugin

Show Ads In Middle Of All Post In WordPress Without Plugin

Show-Ads-In-Middle-Of-All-Post-In-WordPress-Without-Plugin
You have seen many blogs which includes advertising middle of their posts. These advertising are usually possibly as soon as the first piece or even the second piece normally. Most newcomers question whether or not these kinds of internet sites place advertising manually once they compose this article, or even if there is an exclusive rule due to this. In this posting, most of us will disclose how to place advertising in your posts without editing all previous or new ones too with your codes. Later you can change your middle ads at once that will effect on your all blogs posts too.

Web-Page Heat Map:

Web-Page Heat Map

As you can see best position is very top left and in middle of content. First what user see is usually very left part of header. While reading content, visitor is looking for informations and that’s why ad in middle of post can raise CTR since visitor pay fully attention to it. Anyways, you should test and try different type of ads and placings because for different types of people and websites works different ad sizes and placements. Many of you will be familiar with the famous Google AdSense heat map which shows the areas of your website or blog where you should place advertising in order to maximize your profits. Oddly enough, there is no mention of a placement in the middle of your posts. So here is the screenshoot of google webpage checker heatmap that where is the more impression left by the visitor.

Features:

1.) You Don’t Have To Edit Your Blog Posts.
2.) You Can Add Or Change Ads Code Via Template.
3.) Changing Will Effect On All Blog Post Within Seconds…
4.) You Can Also Add Any Text, Image, HTML, JavaScript Code Via This.
5.) It Will Insert Your Data Or Ads Code In Blog Post.
6.) Quick To Load And Easy To Add.
7.) Increase Your Earning.
8.) New Place For Adsense Placement.
9.) No Plugins Needed.
10.) You Can Also Add Google Adsense Or Any Third Part Ads Codes.
11.) You Can Also Customize Ads DIV In The Middle Of Post Via Template.
12.) No Need To Edit Your Post Again For Any Purpose.
13.) Short Code.
14.) Pure PHP Code.
15.) Will Not Effect Your Post Loading.

Recommended For You:
SEO Expert Analyzing SEO Mistakes Even Professionals Make

How To Show Ads In Middle Of All Post In WordPress Without Plugin?

Step 1.) Copy the below code and Paste in your Theme Functions(functions.php) file.

<?php
//Insert ads after second paragraph of single post content.
add_filter( 'the_content', 'prefix_insert_post_ads' );
function prefix_insert_post_ads( $content ) {	
	$ad_code = '<div>Ads code goes here</div>';
	if ( is_single() && ! is_admin() ) {
		return prefix_insert_after_paragraph( $ad_code, 2, $content );
	}	
	return $content;
}
// Parent Function that makes the magic happen
function prefix_insert_after_paragraph( $insertion, $paragraph_id, $content ) {
	$closing_p = '</p>';
	$paragraphs = explode( $closing_p, $content );
	foreach ($paragraphs as $index => $paragraph) {
		if ( trim( $paragraph ) ) {
			$paragraphs[$index] .= $closing_p;
		}
		if ( $paragraph_id == $index + 1 ) {
			$paragraphs[$index] .= $insertion;
		}
	}	
	return implode( '', $paragraphs );
}

Step 3.) Update and Done.

Customization:

Now its time to add your ads. You just have to add Ads codes instead of <div>Ads code goes here</div>. Now to change the paragraph no after which your ads should appear, justchange 2 with your desired paragraph no.

Last Words:

This is what we have and shared in easy steps for newbies so that they can easily know how it works. Stay with us because we are going to share a whole guide step by step about WordPress and make it easy for you. If you liked it then share it and be with us to get next tutorial. If you have any problem then feel free to ask us. We will help you with what we can or have.

Recommended For You:
How Can Show Product Video Instead Of Images In WooCommerce?

You Like It, Please Share This Recipe With Your Friends Using...

Be the first to write a comment.

Leave a Reply

Your email address will not be published. Required fields are marked *