I just put this code into functions.php to create a new field on the registration form. Works great. The only thing is: I want the field to allow number only input.
which I use in the actual field call thusly:
<input type="number" name="yearly_income" id="yearly_income" class="input" value="<?php echo esc_attr(stripslashes($yearly_income)); ?>" size="25" onkeypress="return forceNumber(event);" /></label>
The only thing is I am having a difficult time finding out how to include it. At first I just plugged it in to the very top of the functions.php file – it worked great on the field but did not like it and gave me an error on the registration page “cannot modify header information”.
After reading a number of tutorials and posts about wp_enqueue I tried to include it in various ways with no luck. I did create a seperate js file “forceNumber.js” and have tried to call it a number of ways without success.