Skip to content

Commit

Permalink
fixes #1486
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Jul 29, 2017
1 parent aeaa8cd commit 3513cec
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions field/class-kirki-field-number.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ public function sanitize( $value = 0 ) {
$value = filter_var( $value, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION );

// Minimum & maximum value limits.
if ( $value < $min || $value > $max ) {
return max( min( $value, $max ), $min );
if ( $value < $this->choices['min'] || $value > $this->choices['max'] ) {
return max( min( $value, $this->choices['max'] ), $this->choices['min'] );
}

// Only multiple of steps.
$steps = ( $value - $min ) / $step;
$steps = ( $value - $this->choices['min'] ) / $this->choices['step'];
if ( ! is_int( $steps ) ) {
$value = $min + ( round( $steps ) * $step );
$value = $this->choices['min'] + ( round( $steps ) * $this->choices['step'] );
}
return $value;
}
Expand Down

0 comments on commit 3513cec

Please sign in to comment.