Code Snippet To Change WordPress Logo On Login Page Under 3 Minutes

elegant themes affiliate

In this post, you are going to learn how to change wordpress logo on login page under 3 to 5 minutes. If you are running any online business or an e-commerce website where your visitors need to sign the registration form, then the default wordpress logo is surely going to damage your brand reputation. In this case, this tutorial is going to be your brand’s lifesaver.

The big deal. One of the biggest problems with wordpress is that it doesn’t provide any option to customise the login page. Now let us assume that you run a magazine or a personal blog and you allow your readers to subscribe to your blog. Now once your visitor visits the default registration form, the bad thing happens.

But there is absolutely nothing to worry about it as there are many different ways to customise and modify it. But in this post, I am going to share a code snippet along with detailed explanation.

Change WordPress Logo On Login Page With This Code Snippet

change wordpress logo on login page

Now I’m going to provide you with simple PHP function which will allow you to easily change WordPress logo on the login page or on the registration page.

What you have to just do is to copy the complete code and paste it into your themes function.php file. Remember that you have to paste the code at the bottom. You can edit your theme’s functions.php file either through cPanel also WordPress default theme editor.

The custom PHP function has been provided below

function modify_logo()
{
   echo '<style type="text/css">
   
   //Change the name "folder" with the themes folder name in which your image is kept
  
   h1 a { background-image:url(/folder/image.png) !important; }
 
   </style>';
}

add_action('login_head', 'modify_logo');

Explanation of the function

Now let me explain you this custom PHP function.but in order to understand it you must have a basic knowledge of PHP and CSS.

First of all, we know that we need to change the logo on the login, admin and registration page. So we need to first find the CSS element to which the logo is linked. In our case, it’s H1 tag which is wrapped inside the login id. So we need to change or modify this element through our theme’s stylesheet. In order to modify it I have added a new background style which loads the image either through the theme’s image folder or through the direct link. Finally, you will notice that I have echoed style tag since and within it I have added a new background style which loads your brand logo. Then finally with the help of add_action I have hooked this function with the theme.

Leave a Comment