Many WordPress users wants to insert ads within WordPress post content because that is one of the best spot to show important ads and increase conversion rate.
If you want to increase the click through rate of your AdSense advertisement and increase revenue then you need to start adding ads within your post content
However, there are number of users who doesn’t have idea about how to insert ads within WordPress post content. Many users place the advertisement code manually which is definitely not the correct way.
So, in this post we will discuss about how to insert ads within WordPress post content effectively which can be replaced with other ads anytime you want.
We will talk about two WordPress plugins which will make it real easy for you to place the advertisement code within the post content and replace it whenever you want to.
[symple_box style=”boxinfo”]Place Ads within WordPress Post Content
[/symple_box]
Insert Post Ads
Insert Post Ads is the first plugin we want to discuss about, this plugin is developed by the WPBeginner team, Syed Balkhi of WPBeginne,and n7Studios.
Insert Post Ads is a simple and to the point plugin to do it’s expected task, once you activate the plugin it will bring in the new option called “Post Adverts” on your WordPress dashboard.
It works like a custom post type for WordPress which will let you insert the advertisement code easily.
This plugin comes with a simple settings page to define where you want to display the ads, in the options you will get the custom post types on your site along with normal WordPress post and pages.
To add new advertisement code, go to Post Advert > Add New where you can place your advertisement code and select the number of paragraph after which you want to Display the advertisement
Now, if you don’t want to increase the number of plugin and get this job done through code the wpbeginner team provides you perfect solution to make this work for you.
All you need to do is to add the following code to your functions.php file, don’t forget to edit and replace the “Ad code goes here” section with the code of your advertisement.
<?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 ); }
Code courtesy wpbeginner
Wp-Insert
Wp-Insert is the second plugin we want to discuss about which will help you to insert ads within WordPress post content.
Once you activate the plugin, you will get the option called “Wp Insert” on your WordPress dashboard where you can place and manage the code for your advertisements.
This plugin provides you number of options as in where exactly you want to display the advertisement
- Insert Ads above the content.
- Insert Ads below the content.
- Insert Ads in the middle of the content.
- Insert Ads to the left of the content.
- Insert Ads to the right of the content.
The best part of this plugin is the Geo Targeting option which enables you to show different ads for different geographical locations.
Wp-Insert is a really powerful WordPress plugin which can do more than just displaying your advertisements, you can check the details and download the plugin from the link below.
Leave a Reply