Skip to content

Instantly share code, notes, and snippets.

@styledev
Created June 18, 2013 18:34
Show Gist options
  • Save styledev/5808028 to your computer and use it in GitHub Desktop.
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.
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