Creating a stylesheet that will be used when viewing the site admin side (e.g. editing a post)

In functions.php:

//***** LOAD ADMIN VIEW STYLES WE WANT TO USE *****
function admin_style() {
    wp_enqueue_style('admin-styles', get_stylesheet_directory_uri() . '/style-admin.css');
}
add_action('admin_enqueue_scripts', 'admin_style');

Create a file called style-admin.css and store in your theme’s root folder (along with style.css).
Some example content:

/*----- Set our heading fonts in a special way -----*/

.is-desktop-preview h4 {
  font-size: 20px;
  line-height: 24px;
}

.is-desktop-preview h5 {
	font-size: 16px;
	line-height: 22px;
	color: #fff;
}
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *