Created
June 18, 2013 18:34
-
-
Save styledev/5808028 to your computer and use it in GitHub Desktop.
Updated create_field to set step to "any" if option is not specified.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function create_field( $field ) | |
{ | |
$o = array( 'id', 'class', 'min', 'max', 'step', 'name', 'value' ); | |
$e = '<input type="number"'; | |
foreach( $o as $k ) | |
{ | |
$val = $field[ $k ]; | |
if ( $k == 'step' && empty($val) ) $val = 'any'; | |
$e .= ' ' . $k . '="' . esc_attr( $val ) . '"'; | |
} | |
$e .= ' />'; | |
echo $e; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment