自定义Customize文本框的高度
在WordPress后台,增加自定义文本框textarea,默认高度可能不太合适,以下代码可以自定义它的高度
rows=”2″ 就是它的高度,或者按需要增加其它属性!
/**
*** Add Slogan
***************************************************************/
add_action( 'customize_register', 'cq_slogan_register' );
function cq_slogan_register( $wp_customize ) {
if (class_exists('WP_Customize_Control')) {
class Cq_Slogan_Title_Control extends WP_Customize_Control {
public $type = 'slogan-title';
public function render_content() {
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<textarea class="large-text" rows="2" <?php $this->link(); ?>>
<?php echo esc_textarea( $this->value() ); ?>
</textarea>
</label>
<?php
}
}
}
// Home SEO Slogan
$wp_customize->add_setting( 'home-slogan', array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( new Cq_Slogan_Title_Control( $wp_customize,'home-slogan', array(
'label' => __( 'Home Slogan', 'cq' ),
'description' => esc_html__('', 'cq'),
'type' => 'textarea',
'section' => 'title_tagline',
'settings' => 'home-slogan',
) ));
}
0
Say Something!