Prem Tiwari - - WordPress, WordPress Beginners, WordPress Snippets
In today’s tutorial i will explain how to create a custom WordPress admin themes. WordPress is very flexible nature you can customize almost every part of WordPress. WordPress have lots of hooks & filters to customize it’s default features.
Today i have explained a very easy steps to create WordPress admin theme. To customize the WordPress admin theme create a WordPress plugin OR you can simply modify the css as you want, but the recomendded way is to create a WordPress plugin.
The second method is very easy & simple as you can plug & play and it works. Lets start create a plugin to customize WordPress admin theme.
Go to the wp-content => Plugins and create a folder as you want i have created “fm-admin-theme” folder. Then create index.php and style.css like below.
Now open index.php file
and create header of your plugin like below example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | < ?php /* Plugin Name: My Admin Theme Plugin URI: https://freewebmentor.com/custom-admin-theme Description: My WordPress Admin Theme - Upload and Activate. Author: Prem Tiwari Version: 1.0 Author URI: https://freewebmentor.com */ ?> |
1 2 3 4 | Copy paste below WordPress actions to include your style.css file in WordPress admin area. |
1 2 3 4 5 6 7 | function my_admin_theme_style() { wp_enqueue_style('my-admin-theme', plugins_url('style.css', __FILE__)); } add_action('admin_enqueue_scripts', 'my_admin_theme_style'); add_action('login_enqueue_scripts', 'my_admin_theme_style'); |
You can change the default WordPress admin footer text from “Thank you for creating with WordPress.” to as you want. Lets change the the footer text. Copy paste below code in plugin’s index.php file.
1 2 3 4 5 6 7 | function my_crazy_admin_footer() { echo '<p>This theme was made by <a href="http://example.com">Ms. WordPress</a>.</p>'; } add_action('admin_footer', 'my_crazy_admin_footer'); |
There are two section of admin footer Left and Right. Below is the code to change left and right both separataly.
To change the left admin footer’s text, use below code.
1 2 3 4 5 6 7 8 | function left_admin_footer_text_output($text) { $text = 'How much wood would a woodchuck chuck?'; return $text; } add_filter('admin_footer_text', 'left_admin_footer_text_output'); //left side |
To change the right admin footer’s text, use below code.
1 2 3 4 5 6 7 8 | function right_admin_footer_text_output($text) { $text = 'That\'s purely hypothetical.'; return $text; } add_filter('update_footer', 'right_admin_footer_text_output', 11); //right side |
Now add custom style in style.css file
as per you requirement. Now login in to your website admin panel and go to the Dashboard => Plugins => Installed Plugins. Search “My Admin Theme” and click on the activate option to enable plugin features in your WordPress website.
Prem Tiwari is the founder of FreeWebMentor.com and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies. View all posts by Prem Tiwari
Tags: add css to wordpress page, create custom wordpress plugin, custom wordpress plugin, how to create wordpress plugin, WordPres admin theme