0

There are probably dozens of better ways to do this, but I'm still learning the ins and outs, so I'm starting basic. I'm trying to set up a range (working), for the logo, that scales only as tall as the header section is set to.

AKA, So my logo image cannot scale past the header and overflow outside of it, if the header is set to a smaller size. I have everything working except being able to call the header_height_setting, as the maximum for my array.

Any and All help is appreciated!

Edit: No error is given,'header_height_setting' is just not being used as the max range as expected. The [max] for the scale, seems to be defaulting to 100px for the slider.

My Settings

$wp_customize->add_control('header_height',
array(
'settings'      => 'header_height_setting',
'section'       => 'header_section',
'type'          => 'range',
'label'         => __( 'Height', 'kd_bhw' ),
'input_attrs' => 
array(
'min' => 0,
'max' => 1000,
'step' => 1,
),
)
);
----------
$wp_customize->add_control('logo_scale',
array(
'settings'      => 'logo_scale',
'section'       => 'logo_section',
'type'          => 'range',
'label'         => __( 'Logo Scale', 'kd_bhw' ),
'active_callback' => 'logo_uploaded',
'input_attrs' => 
array(
'min' => 1,
'max' =>  'header_height_setting',
'step' => 1,
),
)
);

How they are called

height: <?php esc_html_e( get_theme_mod( 'logo_scale' ) ); ?>px;
max-height: <?php esc_html_e( get_theme_mod( 'header_height_setting' ) ); ?>px;
faeyren
  • 13
  • 4
  • Are you getting any error? Please add description what is the current behavior and optionally error. – Daniel Hornik Jan 13 '21 at 23:11
  • No error is given,'header_height_setting' is just not being used as the max range as expected. Basically, I have everything working as intended, but the range slider extends way past what is needed if I use, say 1000 as the max. I thought giving it a dynamic maximum based on the maximum height of the container would work. – faeyren Jan 14 '21 at 16:22

0 Answers0