Create Plugin to change WordPress Login Form in 5 steps
  • LET'S TALK!

    Fill in the form below to make an enquiry or find my contact details on my contact page.

  • This field is for validation purposes and should be left unchanged.

Freelance WordPress Developer

Create Plugin to change WordPress Login Form

The code below will allow us to change the WordPress login page in a few steps.

Create plugin to change WordPress login form steps

1 – Create a folder and named with your plugin’s name, example( ns-loginform )

2 – Inside your plugin’s folder we need to create another folder and named  “assets”, this folder will keep our CSS styling.

3 – On your plugin’s folder create a PHP file with your text editor and add the code below named your-plugin-name.php the name has to match the plugin’s folder name.

Your plugin PHP file will look like the same below.

<?php
/**
 * Plugin Name:       your-name
 * Plugin URI:        http://yoururl.com
 * Description:       Change logo and style wordpress login form  
 * Version:           1.0
 * Author:            Your Name
 * Author URI:        http://yoururl.com
 * Text Domain:       yoururl.com

**/

/**
 *
 * Exit if accessed directly.
 */
defined( 'ABSPATH' ) || exit;

/**
 *
 * Add custom background image
 */
if ( ! function_exists( 'ns_custom_login_logo' ) ) {
function ns_custom_login_logo() {
  echo '<style type="text/css">h1 a { background-image:url( http://nuno-sarmento.com/wp-content/uploads/2018/02/nuno_logo.svg) !important; } body{background: #e0e0e0 !important; }</style>';
}
add_action('login_head', 'ns_custom_login_logo');
}

/**
 *
 * Change image wordpress link to website home page
 */
if ( ! function_exists( 'ns_login_logo_url' ) ) {
function ns_login_logo_url() {
  return get_bloginfo( 'url' );
}
add_filter( 'login_headerurl', 'ns_login_logo_url' );
}

/**
 *
 * Change login title
 */
if ( ! function_exists( 'ns_login_logo_url_title' ) ) {
function ns_login_logo_url_title() {
  return 'Nuno Sarmento - Freelance WordPress Developer';
}
add_filter( 'login_headertitle', 'ns_login_logo_url_title' );
}

 

Thank you for seeing my tutorial and feel free to share and comment :). Do you have a code snippet and you want to see it published on my site? I will be more than happy to do it please send me a message (here)

ABOUT AUTHOR

Nuno

Hi, I'm a Freelance Web Developer and WordPress Expert based in London with a wealth of website development and support experience. I am great at problem solving and developing quick solutions.