Basic Customization Of The Admin Login Page And The Admin Dashboard in WordPress
In this tutorial I would be sharing with you how you can do the following
• Replace the logo and logo link on the wp-admin page to whatever suits you
• Replace the content of the WordPress Admin Dashboard Footer
• Remove menu items from the dashboard sidebar
Requirements
• WordPress Installation
• Basic Knowledge Of PHP
Difficulty
• Intermediate
Customizing The WordPress Dashboard And Admin Area
A lot of the functionalities we will be adding will be added in the functions.php
file of your WordPress theme.
To locate the functions.php
file go to Appearance > Editor
Changing the Login Page Logo and Logo Link
The first thing I will be showing you is how to replace the logo on the wp-login.php
page
To do that open the functions.php
file in your theme editor page and paste the following code into it
// CHANGE ADMIN LOGIN HEADER LOGO
function my_custom_login_logo()
{
echo '<style type="text/css"> h1 a { background-image:url(' . get_bloginfo('template_directory') . 'images/pic_path.png) !important; } </style>';
}
add_action('login_head', 'my_custom_login_logo');
In order to specify the path to the logo you want to use as replacement, change the piece of code images/pic_path.png
to whatever path you have set in your theme folder.
Update the functions.php file and logout to see the result of our work.
Next is the link the logo we just changed leads to, the logo links to the WordPress main website homepage but you can change it to lead to your wp-login.php
page instead and here’s how you can do that.
In your functions.php
file paste following block of code
// ADMIN LOGIN LOGO LINK
function change_wp_login_url()
{
echo bloginfo('url'); // INSERT YOUR DESIRED URL HERE AFTER ‘echo’
}
add_filter('login_headerurl', 'change_wp_login_url');
// ADMIN LOGIN LOGO LINK ALT TEXT
function change_wp_login_title()
{
echo get_option('blogname'); // INSERT YOUR DESIRED ALT TEXT AFTER ‘echo’
}
add_filter('login_headertitle', 'change_wp_login_title');
Update the functions.php
file and check the login page for results.
Changing The Dashboard Footer Text
On the WordPress admin dashboard the default footer content is “Thank you for creating with WordPress”
.
You can change the content on the WordPress footer to whatever you wish by adding the following block of code in your functions.php
file.
// Admin footer modification
function remove_footer_admin ()
{
echo 'This will be on <a href="utopian.io" target="_blank">Utopian Open Source Platform</a>';
}
add_filter('admin_footer_text', 'remove_footer_admin');
You can edit the content of the footer directly by replacing the content after the word ‘echo’ inside the curly braces with your custom content.
After pasting the code in your functions.php
file, update the file and check for result
Remove Menu Items From the Dashboard Sidebar
On the WordPress dashboard you can choose to remove any of the menu options on the dashboard sidebar.
In this tutorial we will be removing the last three sidebar options which are Users
, Tools
and Settings
options.
To remove the desired options paste the following lines of code in the functions.php
file
add_action( 'admin_menu', 'my_remove_menu_pages' );
function my_remove_menu_pages() {
remove_menu_page('users.php');
remove_menu_page('tools.php');
remove_menu_page('options-general.php');
}
Call the remove_menu_page()
function for every option you want to remove using the name of the option as the parameter for the function.
After adding all the options you wish to remove, update the file and check for results.
Check out other contributions from me
Posted on Utopian.io - Rewarding Open Source Contributors
i am inspire about him from your post.
thank you for your post.
@gotgame, Upvote for supporting you.
great writing and good job dear @gotgame.i always wtih you dear.so 100% love and 100% upvote.
keep it up dear
@gotgame
Your contribution cannot be approved because it does not follow the Utopian Rules.
Your tutorial is far too trivial to be accepted.
You can contact us on Discord.
[utopian-moderator]