I noticed in digitalpoint posts, adsense gets automatically displayed right in the middle of the post. I was wondering if it is possible to do this in wordpress posts as well via a plugin or otherwise. Thanks.
Then you can try something like this: $s="I noticed in digitalpoint posts, adsense gets automatically displayed right in the middle of the post. I was wondering if it is possible to do this in wordpress posts as well via a plugin or otherwise."; $adsense='<br><br>ADSENSE HERE<br><br>'; $arr=split(" ",$s); $words_count=sizeof ($arr); if ($words_count<2) echo("first part: ".substr($s,0,strlen($s)/2)).$adsense."second part: ".substr($s,strlen($s)/2); else for ($i=0;$i<=$words_count;$i++) { echo $arr[$i].' '; if ($i==floor($words_count/2-1)) echo $adsense; } PHP:
Thanks for the code snippet, I will try it out and let you know how it goes, any particular file I should place it in?
You should place it anywhere where you want to place the adsense block This code only divides some string ($s) on two equal parts (by count of the words) and inserts the adsense block ($adsense) between these parts.
hello, i set $s=<?php the_content(__('Read more'));?>; because that's where i need the adsense to be displayed in the middle of but the Adsense still displays right on top of the post. Any suggestions? Thanks in advance