1- Abra o arquivo functions.php do seu tema e adicione o seguinte código
function content_ads_dentro($content) {
// only do this if post is longer than 1000 characters
$enable_length = 1000;
// insert after the first </p> after 500 characters
$after_character = 400;
if (is_single() && strlen($content) > $enable_length) {
$before_content = substr($content, 0, $after_character);
$after_content = substr($content, $after_character);
$after_content = explode('</p>', $after_content);
$text = '
Código do seu anuncio aqui ';
array_splice($after_content, 1, 0, $text);
$after_content = implode('</p>', $after_content);
return $before_content . $after_content;
}
else {
return $content;
}
}
add_filter('the_content', 'content_ads_dentro');
2 - Perceba no código acima o local onde vai colocar seu anuncio.
function content_ads_dentro($content) {
// only do this if post is longer than 1000 characters
$enable_length = 1000;
// insert after the first </p> after 500 characters
$after_character = 400;
if (is_single() && strlen($content) > $enable_length) {
$before_content = substr($content, 0, $after_character);
$after_content = substr($content, $after_character);
$after_content = explode('</p>', $after_content);
$text = '
Código do seu anuncio aqui ';
array_splice($after_content, 1, 0, $text);
$after_content = implode('</p>', $after_content);
return $before_content . $after_content;
}
else {
return $content;
}
}
add_filter('the_content', 'content_ads_dentro');
2 - Perceba no código acima o local onde vai colocar seu anuncio.
Postar um comentário