• 20-04-2021, 13:27:10
    #1
    Temanın belli yerlerine reklam kodlarını eklemek için Özelleştir'e bir Textarea ekledim ve gösterilecek yerleri de belirledim ancak söz konusu Google Adsense olunca(javascript kaynaklı muhtemelen) bu alana eklediğim kodlar düzgün çalışmıyor. Çıktı şu şekilde: https://prnt.sc/11qy6ij Bunun sebebi nedir acaba? Kodlar ve ekran görüntüsü aşağıda.

    function dmtheme_theme_customizer( $wp_customize ) {
    //Footer text area
        class dmtheme_Textarea_Control extends WP_Customize_Control {
            public $type = 'textarea';
            public function render_content() {
        ?>
        <label>
            <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
            <textarea rows="4" style="width:100%;" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>
        </label>
        <?php
            }
        }
    // Add Ads settings section 
        $wp_customize->add_section('dm_ads_settings',
            array(
                'title' => __('Ads Settings','laura'),
                'priority'    => 36,
            ));
        $wp_customize->add_setting('textarea_ads_content_top', 
            array(
                'default' => '',
                'sanitize_callback' => 'laura_sanitize_text',
            ));
        $wp_customize->add_control(new DMTheme_Textarea_Control($wp_customize, 'textarea_ads_content_top', 
            array(
                'label' => __('Ads Content Top','laura'),
                'section' => 'dm_ads_settings',
                'settings' => 'textarea_ads_content_top',
            )));
        $wp_customize->add_setting('textarea_ads_content_bottom', 
            array(
                'default' => '',
                'sanitize_callback' => 'laura_sanitize_text',
            ));
        $wp_customize->add_control(new DMTheme_Textarea_Control($wp_customize, 'textarea_ads_content_bottom', 
            array(
                'label' => __('Ads Content Bottom','laura'),
                'section' => 'dm_ads_settings',
                'settings' => 'textarea_ads_content_bottom',
            )));
    }
    add_action('customize_register', 'dmtheme_theme_customizer');
    <?php if(wp_kses_post(get_theme_mod( 'textarea_ads_content_top', 'ads content top' ))){ ?>
        <div class="ads-content-top">
            <?php echo  wp_kses_post(get_theme_mod( 'textarea_ads_content_top', 'ads content top' )) ?>
        </div>
    <?php }?>

  • 20-04-2021, 13:39:30
    #2
    Sadece adsense sahiplik kodunu yerleştirmek istiyorsanız;

    function wpdAd() {
    echo 'Kodunuz';
    }
    add_action( 'wp_footer', 'wpdAd ', 100 ); ?>
  • 20-04-2021, 13:52:19
    #3
    EnesCanturk adlı üyeden alıntı: mesajı görüntüle
    Sadece adsense sahiplik kodunu yerleştirmek istiyorsanız;

    function wpdAd() {
    echo 'Kodunuz';
    }
    add_action( 'wp_footer', 'wpdAd ', 100 ); ?>
    Yok hocam panele eklediğim kodun çalışmasını istiyorum ben, normalde çalışması gerekiyordu ama bir şekilde çalışmadı bozuluyor. Kaydedip sayfayı yenileyince kodu değiştirdiğini fark ettim. Kodu buradan yazamadığım için PM attım görmeniz için.