Klasa ne postoji - Custom kontrole (Customization API)

Pozdrav

Omogucio sam Customizer unutar moje teme.Dodao neke osnovne kontrole poput dodavanja logo-a i sl. i to radi OK.Pored toga kreirao sam novi fajl unutar kojeg cu dodavati neke custom kontrole, nazvao sam ga class-customizer-control.php.

Unutar ovog fajla sam kreirao jednu funkciju unutar koje cu smjestiti custom kontrole (class).Konkretno class-customizer-control.php izgleda ovako:

<?php
include_once ABSPATH . 'wp-includes/class-wp-customize-control.php';
/**
*    Add Custom controls to Customizer API
*/
function bedakb_gamer_customcontrols() {
    class Custom_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="5" style="width:100%;" <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea>
            </label>
            <?php
        }
    }
}
add_action('customize_register', 'bedakb_gamer_customcontrols');
?>

Nakon toga unutar customize fajla sam dodao konrolu koja koristi ovu custom kontrolu i to, izmedju ostalog izgleda ovako:

$wp_customize->add_control( new Custom_Textarea_Control($wp_customize, ‘bedakb_ad728’, array(
        ‘label’        => __(‘Adsense 728x90’, ‘bedakb_gamer’),
        ‘section’    => ‘bedakb_adsense’,
        ‘priority’    => 10,
    )));

No pored svega toga, kada pokusam otvoriti Customizer preko WP Admina, dobijem error gdje pise da ova klasa ne postoji.

Fatal error: Class ‘Custom_Textarea_Control’ not found in C:\xampp\htdocs\wp2\wp-content\themes\bedakb_gamer\inc\customizer.php on line 35


Copyright © 2020 WM Forum - AboutContact - Sponsored by: Mydataknox & Profit Monkey