Created
June 27, 2012 12:38
-
-
Save kachi/3003835 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('the_content', 'ads_more_tag'); | |
function ads_more_tag($text) { | |
if( is_single() ) : | |
$ads_text = '<span> | |
//アドセンスのコード | |
</span>'; | |
$pos1 = strpos($text, '<span id="more-'); | |
$pos2 = strpos($text, '</span>', $pos1); | |
$text1 = substr($text, 0, $pos2); | |
$text2 = substr($text, $pos2); | |
$text = $text1 . $ads_text . $text2; | |
endif; | |
return $text; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment