2.6 Other Small Customizations
1.Introduction3 lessons, 06:23
2.Customization: Smaller Tasks6 lessons, 38:49
3.Customization: Bigger Tasks5 lessons, 24:53
4.Conclusion1 lesson, 00:40
2.6 Other Small Customizations
>> Apart from the stuff you've learned so far, there are a few minor things you can tweak in the admin area. Let's check them out. One of these smaller customizations you could do, is change the text that appears by default in the footer right here. So, for that, we're gonna write a function called change_admin_footer and inside were gonna echo our new text. Lets say, Hello, this is a custom footer text. And then were gonna add a filter to admin_footer_text and we're gonna tie in our function there. All right, so now if we refresh. Oops, we have a syntax error somewhere, let's see, add filter function. Hello? Forgot that. So, now we have this. Hello, this is a custom footer text. Now, you're not limited to text only, you can put images, you can put links, whatever HTML you want. Now, on the other side we see the version here. Now, if you want, you can also remove this. That's really easy to do, let's write a function called remove_footer_version and tie it in, add_action, it's gonna be admin_menu remove_footer_version. And inside, we'll simply do remove_filter, update_footer, core_update_footer and now refresh and it's gone. Of course, you can also hide this via CSS if you so desire. So, if you go here you're gonna do a inspect and you're gonna see a paragraph with an ID of footer upgrade. So, you can target that in CSS and set its display to none for example. Now let's talk about widgets and when you go to Appearance > Widgets. You see a bunch of them, but what if there are some that you don't need? For example, Recent Comments because we're not using comments in our page or RSS maybe, or Search or Calendar. Well, it's really easy to disable them and you would do that with the unregister widget function. So, let's actually search it here real quick and what's nice about the codex is that it gives you all the classes that you need. So, here you basically have a function that you tie it into widgets in it. So let's actually go ahead and copy this and we're gonna rename this to disable_wp_widgets and first of all, we're gonna register the calendar and then maybe the search and recent comments. So that's gonna be Widget_Search and Recent_Comments, all right. And this ties into widgets_init. Now, if we're gonna refresh. We're gonna see that those widgets are removed from both the available widgets and from any widget area that contained them. And finally, for an additional customization you can make. That's related to the WYSIWYG editor, and that editor is actually present for example, here. When you add a post, or an article, or a page, you can actually target this and add a custom style. So, to do that, we're gonna write a function here called add_editor_styles and we're gonna tie it to the admin in it. And inside, we're gonna say add_editor_style, singular, editor-style.css. Now, in here, you basically put the path to a CSS file. So, let's actually go ahead and create a new file here called editor-style.css and inside, you can write styles for the editor. So let's go ahead and inspect this, so we can get an idea of what's going on. So, let's actually target this bit. There are a bunch of bunch of classes here, so it might be a bit difficult at first first and let's target this. The body with an idea of tinymce and then with the class of wp-editor and that should do it. So we're gonna say body, tinymce with a class of wp-editor. And let's write some simple CSS here. First of all, let's see what kind of font we have. So, if I type something in here. All right, let's change that font actually font_family, let's put, for example, Lato with a fall back to Helvetica and sans-serif. All right, so now refresh, we have a different font. Let's put the margin for example, to 100 pixels just for the kick of it, let's refresh. Okay, and now we have a margin of 100 pixels. And you can even change for example, the background-color. Let's put something like a very light grey, like this, and now we have a different background color. So, of course you can play around with this as much as you want. You can change the properties and you can basically change everything on it. Including these icons here, the padding, the margin, the fonts and that's basically it for these smaller customizations. Now, the stuff we've done so far is pretty simple in terms of customization, so let's dig a little deeper and tackle the bigger aspects of the WordPress admin that you can tamper with. So, coming up next, we'll have a look at custom color schemes.