Best WordPress Plugin to Show Ads In Post or Page

In WordPress you can easily show affiliate ads inside posts or pages. To get maximum amount of hits most of users show ads inside posts. There are many plugin available to insert your ad. One of the best WordPress plugin to show ad in post or page is Post Adverts. You can download it from WordPress plugin directory. Here is the steps to install and use of this plugin:

show-ad-inside-post-featured

 

Fist of all add thee following code in your theme functions.php:

[html]add_filter( ‘the_content’, ‘prefix_insert_post_ads’ );

function prefix_insert_post_ads( $content ) {

$ad_code = ‘<div></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 );
}[/html]

Then install Post Adverts plugin we have told you earlier in first paragraph. Then after installing insert a new ad from Post Advert->Add New menu:

show-ad-inside-post

 

Then go to settings page select to where you want to show the ad. You can select both posts or pages:

show-ad-inside-post1

 

In front-end you can see the ad inside posts:

show-ad-inside-post2

 

Get more plugins in Free WordPress Plugin category.

Author: mytutorialguru

Share This Post On

Submit a Comment

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