Tag Archives: cms

Styling the WordPress admin interface

wordpress_admin

Wouldn’t it be great if you could style the WordPress admin interface. Well you can and it is easy. In my case, a customer wanted me to remove a link in the User area of the CMS because it became redundant after I installed a user moderation plugin. It annoyed the client that the ‘Pending’ link was still visible in the User area because that link didn’t work anymore as the new plugin overtook that function. The link was placed in a real obvious spot and they kept clicking it when they wanted to moderate users instead of clicking the new link which the plugin placed elsewhere. They asked me if I could remove the link it and in the process I found a way to add in a style sheet for the Admin area which is useful for any kind of styling you may wish to implement.

Create a CSS file

The CSS code I used was as follows. Of course you can add whatever you want.

li.registered {display:none;}

Update your theme’s function file

Here is the code I put in to the function file to implement the new style sheet.

/* CSS in the CMS */
function admin_style() {
wp_enqueue_style('admin-styles', get_stylesheet_directory_uri().'/admin.css');
}
add_action('admin_enqueue_scripts', 'admin_style');

If you don’t use a Child Theme, (you should), then use the following code instead.

function admin_style() { wp_enqueue_style('admin-styles', get_template_directory_uri().'/admin.css'); } add_action('admin_enqueue_scripts', 'admin_style');
}

Now place the CSS file which I called admin.css in your active theme’s root folder. It will be something like: /wp-content/themes/twentynineteen.

Done