My theme automatically assign before of <!--more-->
tags, as excerpt.And showing excerpt on home page. Now i want to add Google Adsense after <!-- more -->
code. I'm wrote this function and add it to functions.php
function google_adsense($content)
{
if(is_single())
{
global $post;
$thePostID = $post->ID;
$more_span = '<span id="more-' .$thePostID.'"></span>' ;
return str_replace($more_span, $more_span . " " . google_reklam_ekle(), $content);
}
}
function google_reklam_ekle()
{
return "<!-- Google Adsense -->
<script type=\"text/javascript\"><!--
google_ad_client = \"ca-pub-9792205570091420\";
/* teknoblogo-yazi-alaninda */
google_ad_slot = \"0917868905\";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type=\"text/javascript\"
src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">
</script>
<!-- bit Google Adsense -->";
}
add_filter('the_content', 'google_adsense');
Now excerpts isn't disappering excerpts. When i remove this functions, they're appearing again.
In single page, code is working very well. You can check my blog posts. http://www.teknoblogo.com . There is an Adsense Ads after tag. But before add this Adsense codes, my post's first part (i mean before of <!--more-->
tag) appearing .
Can you give an idea to me ?