Learn WordPress
Home » Script

Utilized Readmore To Insert Adsense

Adsense Injection

After a while I did not write in this blog, so on this occasion I wanted to write about how utilized readmore to insert Adsense. Another advantage in the sense is utilizing parameter of readmore (<–more–>) inject Adsense.

I know that so many plugins out there that can be exploited and used for injected Adsense in content. And I had written and give you a very simple plugin for injected Adsense into content.

We start from the simple understanding. OK, when you write an article on your blog maybe some of you accustomed to using the parameters readmore. Some of you may well not because it was handled by the parameter excerpt (<?php the_excerpt(); ?>). To that used to use readmore (<–more–>), you can use these parameters to include scripts after the readmore and Google Adsense will appear at page single post (single.php).

ha? First, open your single.php on your theme directory and try to find parameter <?php the_content(); ?>. Now you just need to replace <?php the_content(); ?> with:

<?php
$show_after_p = 0;
$content = apply_filters(‘the_content’, $post->post_content);
if(substr_count($content, ‘<!–more–>’) > $show_after_p)
{
$contents = explode(“<!–more–>”, $content);
$p_count = 0;
foreach($contents as $content)
{
echo $content;

if($p_count == $show_after_p)
{
?>
PLACED HERE YOUR ADSENSE CODE
<?
}
echo “<!–more–>”;
$p_count++;
}
}
?>

Then the Adsense ads will automatically appear on the single post page content you precision after readmore. silau man!

One Comment

FREE Cloud Storage