You have seen several websites with Ads Within the Post Content . Have you Ever Wonder How They Do it ? How they Make More Money Than You ? How they Recieve More Clicks and Money then you ? Which code , snippet or Plugin They Use ? Today I will show you a way to do it easily without any Plugin and large codes .
How to Add Ads Within Post Content in WordPress ?
First Open Your single.php File and look for the content code something like this :
<?php the_content(); ?Replace that code with the codes below:
<?php $paragraphAfter= 3; //display after the first paragraph $content = apply_filters('the_content', get_the_content()); $content = explode("</p>", $content); for ($i = 0; $i <count($content); $i++ ) { if ($i == $paragraphAfter) { ?> <div>Insert Ads Here</div> <?php } echo $content[$i] . "</p>"; } ?>
You may change the number of paragraphs by changing $paragraphAfter line . And Replace ‘Insert Ads Here‘ with your ad content .
it's showing the error in line 3
ReplyDeleteFatal error: Call to undefined function apply_filters() in C:\xampp\htdocs\adclick\single.php on line 3
Its Depends On Your Template
Delete