In this tutorial, I will explain how to add custom CSS to WordPress admin page only. It will help while you are creating a custom WordPress plugins for the client or for your personal need. Sometimes we need to add some custom CSS code to style our admin pages.
Add below code at the end of the wp-contents/themes/your-theme-folder/functions.php file.
1 2 3 4 5 6 7 8 9 10 | add_action('admin_head', 'my_custom_fonts'); function my_custom_fonts() { echo '<style> body, td, textarea, input, select { font-family: "Lucida Grande"; font-size: 12px; } </style>'; } |
You can also add any external CSS file by applying the below code inside wp-contents/themes/your-theme-folder/functions.php file.
1 2 3 4 5 | add_action('admin_head', 'my_custom_fonts'); function my_custom_fonts() { echo '<link rel="stylesheet" href="style.css" type="text/css" media="all" />'; } |
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: add custom css code in wordpress admin, admin add css style, wordpress admin page, wordpress tutorial, wordpress tutorial for beginner, wordpress tutorial for beginners, wordpress tutorials, wordpress tutorials for beginners