I'm hoping someone will help me find an answer to this. I am building a base child theme for the Genesis theme, & am adding to the Theme Customizer to allow quick setup of basic theme settings. Where I'm running into problems is that whenever I try to add a custom control the Customizer breaks. The site still works, just the customizer breaks. My code is this:
add_action( 'customize_register', 'um_register_theme_customizer' );
function um_register_theme_customizer( $wp_customize ) {
// Customizations that work here
I have setup basic color settings that all work. It breaks when I add this setting:
$wp_customize->add_setting(
'um_h6_font_size',
array(
'default' => '1.2'
)
);
$wp_customize->add_control(
new UM_Customize_Number_Control(
'um_h6_font_size',
array(
'label' => __( 'H6 Font Size (in rem)', 'um' ),
'section' => 'um_font_size_options',
'settings' => 'um_h6_font_size',
'type' => 'number'
)
)
);
// Classes
class UM_Customize_Number_Control extends WP_Customize_Control
{
public $type = 'number';
public function render_content()
{
?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<input type="number" size="2" step="1" min="0" value="<?php echo esc_attr( $this->value() ); ?>" />
</label>
<?php
}
}
} // Closes the um_register_theme_customizer function
If I remove the custom control then it works, defaulting to a text input (changing the type to text). What I'm trying to do is to make this a number field.
I was trying to use the same method to make a simple section of h6 text in the customizer for sub-headings, but was running into the same issue.
Any help as to why this isn't working would be greatly appreciated. I'm sure I'm missing something simple.