[wp-trac] [WordPress Trac] #33366: if (get_theme_mod()) returns false if 0
WordPress Trac
noreply at wordpress.org
Thu Aug 13 14:25:26 UTC 2015
#33366: if (get_theme_mod()) returns false if 0
--------------------------+-----------------------------
Reporter: karlikdesign | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 4.2.4
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Seems like the number type isn't returning 0 in the customizer
Here's my control code in functions.php
{{{
$wp_customize->add_setting('apw_header_cta_padding_bottom', array(
'default' => '20' ) );
$wp_customize->add_control(
new Customize_Number_Control(
$wp_customize,
'header_cta_padding_bottom',
array(
'label' => 'Bottom Padding',
'section' => 'apw_header_cta',
'settings' =>
'apw_header_cta_padding_bottom',
'type' => 'number',
'priority' => 30
)
)
);
}}}
Then, in my header.php I have
{{{
<?php if(get_theme_mod( 'apw_header_cta_padding_bottom')) : ?>
}}}
Then, when I preview the site in the customizer and set that value to
zero, this if statement returns false when the value should be zero.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33366>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list