Skip to content
el WP in

el WP in

Random Walk on WordPress Development

  • Home
  • Articles
    • Common WordPress Development
    • WordPress + 3rd party
    • WooCommerce Development
  • About me
  • My Premium Plugins
  • Contact

Tag: wp-login logo link

Posted on December 5, 2020December 30, 2020

WP-Login branding in 25 lines of code – without plugin

There are plenty of plugins and snippets on how to customize your website’s wp-login page. Unfortunately WordPress itself doesn’t provide settings page for thist. But thanks to hooks + CSS + JS it is possible to customize UI components there.

Here is the code piece that i wrote for my own websites, which includes some basic color changes, logo and link replacement etc.

add_action( 'login_enqueue_scripts', function(){
$color_code_from_your_logo='#e87817';//change this to own RGB code
?><style type="text/css">
  #login h1 a, .login h1 a {
  background-image: url(https://yoursite.com/logo.png);
  height:68px;
  width:auto;
  background-size: contain;
  background-repeat: no-repeat;
  padding-bottom: 5px;
  }
  #login .button {background: <?php echo $color_code_from_your_logo;?>;border: none;}
  #login .dashicons{color:white}
  .login .message, .login .success{border-left:4px solid <?php echo $color_code_from_your_logo;?> !important;}
  #loginform,#registerform{width:300px}
  #login{width:350px !important}
  input[type=checkbox]:focus, input[type=color]:focus, input[type=date]:focus, input[type=datetime-local]:focus, input[type=datetime]:focus, input[type=email]:focus, input[type=month]:focus, input[type=number]:focus, input[type=password]:focus, input[type=radio]:focus, input[type=search]:focus, input[type=tel]:focus, input[type=text]:focus, input[type=time]:focus, input[type=url]:focus, input[type=week]:focus, select:focus, textarea:focus {
    border-color: <?php echo $color_code_from_your_logo;?> !important;
    box-shadow: 0 0 0 1px <?php echo $color_code_from_your_logo;?> !important;
  }
  </style>
  <script>
   document.querySelector('#login a').href="<?php echo home_url();?>";
  </script><?php 
});

Once you put this to your theme’s functions.php, try how it looks like in Incognito browser. Then start customizing sizes, colors etc. given in this code.

Get more useful WP tricks and snippets by subscribing to my mailclub.

Thank you! Check your inbox or spam folder to confirm your subscription.

follow us in feedly

Top Posts

  • Unlock ChatGPT Plus with non-US bank cards
  • Make any search form to take a visitor to WooCommerce Search Results page instead of default WP Search Results page
  • Ready to use snippet for WP REST API
  • How quickly get started with Open-AI DALL-E using PHP
  • Rename existing WordPress Attachments files, titles

Tags

  • add google analitycs to wordpress
  • anti brute-force custom script
  • block wp-admin with custom logic
  • cloudflare
  • create wordpress plugin yourself
  • create your own plugin
  • custom wordpress shortcode
  • find slow mysql in wordpress
  • find slow queries in wordpress
  • first post
  • mysql debug in worpdress
  • mysql problematic queries in wordpress
  • php search string in files
  • prevent wp-admin from hackers
  • run php code part by part
  • search files inside wordpress
  • search inside files
  • send email via WordPress
  • sending emails via external mailserver in WordPress
  • simplest way creating wordpress plugin
  • ssl
  • use mail server in WordPress
  • woocommerce
  • woocommerce is installed
  • wordpress adsense shortcode
  • wordpress ajax divided
  • wordpress ajax part by part
  • wordpress anti brute-force
  • wordpress check plugin is activated
  • wordpress check plugin is active
  • wordpress check plugin is installed
  • wordpress detect user location
  • wordpress detect visitor location
  • wordpress development
  • wordpress geolocation
  • wordpress location filter
  • wordpress mail server
  • wordpress recursive file search
  • wordpress search in plugin and theme files
  • wordpress shortcode for google adsense
  • wordpress show products by location
  • wp-admin and attacks
  • wp ajax divided
  • wpdb debugging
  • wp security
Proudly powered by WordPress