Hey, WordPress enthusiasts! Are you tired of the same old, same old when you log into your website’s admin dashboard? Do you want a custom look that’s all your own? Well, you’ve come to the right place. Today we’re going to learn how to customize the WordPress admin dashboard. Put on your coding hats, and let’s dive in!
The WordPress Admin Dashboard is the first screen you see when you log into the administration area of your website. It gives an overview of your site’s content and displays several widgets such as ‘At a Glance’, ‘Activity’, ‘Quick Draft’, etc.
We’ll begin by creating a function to remove some of these default widgets. Let’s say you want to remove the ‘Quick Draft’ widget.
Add the following function to your theme’s functions.php
file:
function remove_dashboard_widgets() {
global $wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets' );
This function removes the ‘Quick Draft’ widget from the dashboard. You can repeat this code for each widget you wish to remove.
Now, let’s create a custom widget to display on your dashboard.
Add this function to your functions.php
file:
function add_custom_dashboard_widget() {
wp_add_dashboard_widget('custom_dashboard_widget', 'My Custom Dashboard Widget', 'custom_dashboard_widget_content');
}
add_action('wp_dashboard_setup', 'add_custom_dashboard_widget');
function custom_dashboard_widget_content() {
echo 'Hello, this is my custom dashboard widget!';
}
This will add a new widget titled “My Custom Dashboard Widget” to your admin dashboard, which simply displays the message “Hello, this is my custom dashboard widget!”. You can modify the widget content to display anything you want.
Now let’s do something about that footer text.
You can modify the admin footer text by adding this function to your functions.php
file:
function custom_admin_footer() {
echo 'Built with love by Your Name';
}
add_filter('admin_footer_text', 'custom_admin_footer');
Replace ‘Your Name’ with your actual name, and voila! Your admin footer text is now personalized.
Lastly, let’s add some custom CSS to change the look of the dashboard.
Add this function to your functions.php
file:
function custom_admin_css() {
echo '';
}
add_action('admin_head', 'custom_admin_css');
This will change the background color of the dashboard and the color of the H1 tags. You can add your own styles as per your needs.
Let’s look at all the code together:
// functions.php
function remove_dashboard_widgets() {
global $wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets' );
function add_custom_dashboard_widget() {
wp_add_dashboard_widget('custom_dashboard_widget', 'My Custom Dashboard Widget', 'custom_dashboard_widget_content');
}
add_action('wp_dashboard_setup', 'add_custom_dashboard_widget');
function custom_dashboard_widget_content() {
echo 'Hello, this is my custom dashboard widget!';
}
function custom_admin_footer() {
echo 'Built with love by Your Name';
}
add_filter('admin_footer_text', 'custom_admin_footer');
function custom_admin_css() {
echo '';
}
add_action('admin_head', 'custom_admin_css');
And there you have it! Your very own, custom WordPress admin dashboard. From widgets to footers to styles, you’re now a master of the WordPress admin. Keep tinkering, keep learning, and happy coding! 🚀
Enables the creation of unique, personalized landing pages at scale by offering unlimited placeholders for dynamic content.
Essential for crafting content-rich, unique pages for each visitor or target group, optimizing for local SEO, e-commerce variability, or specific event details.