Title: floatval on output value
Last modified: August 30, 2022

---

# floatval on output value

 *  Resolved [Rough Pixels](https://wordpress.org/support/users/roughpixels/)
 * (@roughpixels)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/floatval-on-output-value/)
 * 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)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/floatval-on-output-value/#post-15964883)
 * 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](https://wordpress.org/support/users/roughpixels/)
 * (@roughpixels)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/floatval-on-output-value/#post-15965087)
 * 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.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [Rough Pixels](https://wordpress.org/support/users/roughpixels/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/floatval-on-output-value/#post-15965087)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
