How to Create a Custom WordPress Widget

How to Create a Custom WordPress Widget

September 12, 2019 8 By Bernardo Ryan


Do you want to create your own custom
widget in WordPress? Well keep watching in this video 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 log in 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 2017 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 plus 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 WPBeginner widget I can grab the new widget and bring it
over to my sidebar and then we can go take a look and see what it looks like
on our site. Very easy and simple customized widgets that I’ve created for
my website. Did you learn something from today’s video? If so
subscribe to our YouTube channel and we’ll send more helpful tips to help you
manage your WordPress website and thanks for watching