
Bir kaç düzenleme ile istediğiniz paragraftan sonra reklam ekleyebilirsiniz.
İşlem 1:
Ben tasarım 2 yi kullanıyorum. Hangi tasarımı kullanıyorsanız o templeteyi düzenleyin.
/wp-content/plugins/accelerated-mobile-pages/templates/design-manager/design-2/elements/content.phpBuradaki dosyayı ftp den bulup pc ye indirin.
İşlem 2:
İndirdiğiniz dosyayı notepad ile açın.
İşlem 3:
<?php
$amp_custom_content_enable = get_post_meta( $this->get( 'post_id' ) , 'ampforwp_custom_content_editor_checkbox', true);
// Normal Front Page Content
if ( ! $amp_custom_content_enable ) {
echo $this->get( 'post_amp_content' ); // amphtml content; no kses
} else {
// Custom/Alternative AMP content added through post meta
echo $this->get( 'ampforwp_amp_content' );
}
// echo $this->get( 'post_amp_content' ); // amphtml content; no kses
?>Burayı tamamen silin.Yerine bu kodları ekleyin:
<?php
$content = $this->get( 'post_amp_content' );
$contents = explode("</p>", $content);
$p_number = 1;
foreach($contents as $content){
echo $content;
/* 2. paragraftan sonra ekle */
if($p_number == '2'){
echo' <amp-ad class="amp-ad-1" type="adsense" width=300 height=100 data-ad-client="ca-pub-XXXXXXXXXXXXXXXX" data-ad-slot="XXXXXXXXX"></amp-ad>'; }
/* 5. paragraftan sonra ekle */
if($p_number == '5'){ echo '</p><p>'; echo'<amp-ad class="amp-ad-5" type="adsense" width=300 height=250 data-ad-client="ca-pub-XXXXXXXXXXXXXXXX" data-ad-slot="XXXXXXXXXX"></amp-ad>'; }
echo '</p>'; $p_number++;
} ?>Ben 2 reklam ekledim 2 ve 5 paragraf.($p_number == 2)burada olan "2" rakamını kendinizde değişin.
Ayrıca Data AD Client ve Data AD Slot ları girmeyi unutmayın.
Daha ayrıntılı bilgi için: AMP Sayfalarda Yazı İçine Adsense Ekleme