I am very new to WordPress. I am trying to display a login form in the header section of my website. However, when I look at all of the files in my directory it is very overwhelming and I am afraid to touch anything.
Does anyone know of any good tutorials on the topic or perhaps shed some light on the issue?
The login form is a simple html form sending username and password to wp-login.php. This is the simplest way to create a custom login form:
Line by line:
$redirect_to
: If you want the user redirect to a special page, insert the url here. The url will be inserted in the hidden field at the end of the formular<form ... action="...">
: The data has to be send to wp-login.php. This file is in the root of your WordPress installation. Create the right url withsite_url()
(please refer to the codex for more information aboutsite_url()
). The method has to be set topost
user_login
user_pass
Create a formular and style it with css. That’s all.
Create a template file within your child theme directory, let’s say
login.php
. Put the login form inside this file:Change whatever you wish, but you should leave the name attributes intact
Create a
functions.php
file within your child theme directory, or if you have one, edit it. You will fulfill the login requests in it:Create a copy of your
header.php
template, put it in your child theme folder and edit it. Add this code where you want the login form to appear:Also, you can customize the original login form in your WP Theme.
There are a few things that you can do.
1) You can change the Wp logo :
2) You can remove the shake of WP login:
3) Remove the login errors :
Important:
Do not use all of these parts of code to
functions.php
. First create three of them with the names that describe thefunction
like (exmy_custom_login_logo.php
,my_login_head.php
andremove_login_errors.php
) and then call the 3 functions tofunctions.php
e.x.
require_once('includes/secure/my_custom_login_logo.php');
require_once('includes/secure/my_login_head.php');
require_once('includes/secure/remove_login_errors.php');
includes and secure, are folders. I hope to help you. Welcome.
adding codes to wp-login.php. form codes below.