Do you want to create your own custom widget in WordPress? Well keep readingin this article I’ll walk you through how you can create your very own widget for your WordPress website. There are two ways that you can create a custom widget for your WordPress website.
One is you can create a specific plugin that you can use for your website, the other way is to simply add the code that you need to your functions file for your theme. Now if you add it for your theme any time you switch themes then your widget will no longer be available if you switch themes, so keep that in mind when you choose this. As with any changes that you make to your site you’ll want to create a backup of your site before you get started.
I’ll be copying and adding all of this custom code to my functions.php for my theme.
What this is
is it’ll add a greetings widget to the sidebar. Since I’ll be making changes to my functions.php for my theme, I want to open up an FTP client, I use FileZilla. You can get your login credentials from your hosting provider if you don’t know them, but when you first login you see the WP folders here, you’ll want to go into the wp-content,
go into the themes folder,
and you need to know which theme you’re using. I’m using the twentyseveteen theme,
Scroll down until we find the functions.php.
I’m going to right click and download that locally
and once that’s downloaded I’ll open it in a text editor. I have notepad plus,
it is that I’m using and this is all the functions currently in the theme I don’t want to mess with any of those but I do want to scroll all the way down to the bottom. So on the new line going to right click and paste.
Let me save it
back to our FTP client, where I can right click on it and upload it.
I need to overwrite what’s on there
and once that’s done. We can head back over to our WordPress dashboard, go over to my Appearance -> Widgets area. Scrolling down because we named it WPBe widget, I can grab the new widget
and bring it over to my sidebar
and then we can go take a lookand see what it looks like on our site.
Very easy and simple customized widgets that I’ve created for my website.