• Resolved Rough Pixels

    (@roughpixels)


    First time with this one…absint is usable, but this is for absolute numbers, not decimals.

    I have an output from a customizer range slider control (decimal values), but to output the value in an inline stylesheet, I’m curious if this line is correct, or is there an alternative for escaping?

    $site_title_font_size = floatval(get_theme_mod( 'site_title_font_size' ));

    or…

    $site_title_font_size = floatval( esc_attr(get_theme_mod( 'site_title_font_size' ) ));

    or…?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can certainly write it that way. I don’t see a problem with it right now. The crucial thing is that you escape the $site_title_font_size variable in the output (via echo, presumably), which is not visible in your code right now.

    Thread Starter Rough Pixels

    (@roughpixels)

    Thanks for the reply! Just earlier, I realized I needed to move the escaping as late as possible, so I had done that.

    Regarding the floatval, I can now at least get the decimal value outputted in .25 increments.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘floatval on output value’ is closed to new replies.