I’m not sure if there are different approaches for this, but this is a pattern I’ve implemented successfully in several places.
In my approach, I am including the “add_control” inside the function that contains the custom class. The $wp_customize object gets passed in to the main function.
Also, I’m not sure why you are trying to include class-wp-customize-control.php.
Here’s my guess for what you need, assuming you’ve created the “bedakb_adsense” section elsewhere. Just put the following in a php file and call it from your functions.php
<?php
function bedakb_gamer_customcontrols($wp_customize) {
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
}
}
$wp_customize->add_setting( 'bedakb_ad728', array(
'capability' => 'edit_theme_options'
) );
$wp_customize->add_control( new Custom_Textarea_Control($wp_customize, 'bedakb_ad728', array(
'label' => __('Adsense 728x90', 'bedakb_gamer'),
'section' => 'bedakb_adsense',
'priority' => 10,
)));
}
add_action('customize_register', 'bedakb_gamer_customcontrols', 99);