FREELessons: 12Length: 1.3 hours

Next lesson playing in 5 seconds

  • Overview
  • Transcript

3.1 Functions for Customizing the WordPress Admin

In this lesson, you'll learn some functions for customizing the WordPress admin screens. I'll give you an overview of the key functions, and then we'll add them to our plugin.

Related Links

3.1 Functions for Customizing the WordPress Admin

Hello and welcome back to this test plus course on WordPress plugin development. In this part of course we're going to start on our second plugin, which is a plugin to customize the admin screens. But before we dive into writing the code, let me show you some of the options that you have for customizing the WordPress admin. So here's my dashboard for my demo site, this is the main dashboard screen with these widgets that you might be familiar with. So you've got the Welcome to WordPress, at a glance, quick draft and so on and so forth. And you might have noticed that sometimes you'll install a plugin and it might add a new widget to the screen. And that's because there are functions you can use in WordPress that helps you create new dashboard widgets. And you can also remove dashboard widgets if you don't want them there. So in the plug in, I'm going to add a dashboard widget and I'm also gonna take some out. As well as dashboard widgets, you can add widgets to the editing screens. So if I go into the post editing screen here, and click on one of the posts to edit it, there are already widgets over here on the right hand side. As well as widgets if we scroll right down past the content, we've got widgets for things like revisions, excerpts and so forth. And again, you can add and remove this widgets if you want to. It's very common for plugins to add widgets to this screens particularly if those plugins register custom post times. Because they might want to add widgets to the editing screen for the custom post type which will help you edit and add metadata to the post. And in this plugin will add a widget or more correctly called a meta box over here on the right hand side. And you could add on the right or you could add it below or even above the main editing pane if you wanted to, but I'll add it over here on the right. As well as that, you can also add new menus or menu items in the menus and you can add custom settings to the customizer. So there are a myriad of ways that you can customize the WordPress dashboard. Now as the WordPress dashboard moves more and more towards using the customizer and using JavaScript instead of PHP, I predict that being able to add custom controls and settings via the WordPress customizer will be more and more useful. But it's quite a big project to get your teeth into and if you are starting out developing plugins, it's not something I recommend you do straight off the bat. But if you do want to learn about it, you can take a look at this test plus course on writing customizer ready WordPress themes. Now in this case, I've added customizer features to my theme, but you can also write a plugin to add customizer features and customize the customizer. If that's not too many uses of the word customizer, you can customize the customizer via a plugin as well. But we're not gonna be doing that in this course, instead, we're going to be using the dashboard widget API, to add a new widget and to remove some existing ones. And we're also going to use some of the functions provided by the plugin API, which enable us to edit the admin screens. So you can see here there's a link to administrative actions and there are actually dozens and dozens of them. Are we using a specific function here to add a meta box to the post editing page in my site. And just for completeness, here's another link to the settings API. And that's what you would use to add a completely new screen in the admin and add settings for your plugin or theme via that. But for themes, I would have news to customize it instead these days. So that's a quick overview of some of the option you've got for customizing the dashboard. Something else you can do if you want to really get your teeth into it, if you can rebrand the dashboard, and you can target, let me go back to the dashboard here. You can target the CSS that's output by WordPress in the dashboard via a plugin not to a theme because theme styling is only for the front end. But you could write a plugin to customize the dashboard layout, the colors, the branding, you can add your own images if you wanted to, the sky's the limit really. You can create a completely customed dashboard if you want to, but it is a major project and not something we're gonna be getting into in this part of the course. But what we will do is create a plugin that has two things. Firstly, it edits the dashboard, and secondly, it adds a new meta box to the post editing screen. So in the next part of the course, we'll start by editing the dashboard. See you next time, and thanks for watching.

Back to the top