There’s wp_login_form()
for such cases. It offers tons of hooks to extend it.
// In your template
wp_login_form( array( /* Args: refer to Codex page */ ) );
A more in-depth look at the filters, can be found here @GitHub WP Core source.
'login_form_top'
– abovelogin-username
'login_form_middle'
– abovelogin-submit
'login_form_bottom'
– belowlogin-submit
My personal suggestion is: Don’t use an AJAX login form. It’s hard to maintain, much easier to hack (in some cases) and will be a pain, when there’re other parts on the page, that show logged-in/visitor information, as you’ll have to maintain all your login forms on-the-fly UI updates with every change on the page.
If you still want to do the whole thing with AJAX, then I’d suggest to register an event listener/handler to id_submit
(the arg that is used in the template tag above). There you can easily return false;
or use event.preventDefault();
to disable the redirection and roll your own registration (copy core).