Installing a Local WordPress Plugin Development Environment
Articles,  Blog

Installing a Local WordPress Plugin Development Environment


– So to start developing
plugins, you need a system running on your own site,
ideally, so that you can actually develop the
plugin and test it while it’s on your own machine,
and not on a live site. So, the option that I’m
currently using is local Local by Flywheel, which is for free. It used to be a paid program
until Flywheel bought it. And though Flywheel is a
hosting company, you don’t require to purchase
anything from Flywheel. It’s just a system you
can use, and install it on your own machine to run
WordPress without much trouble. So, you just head over to
Free Download, and once you download it, you can install it. And once it’s installed,
you’ll see something like this. So it give you the options
to have as many local sites as you like, and if you
wanna create a new one, you just head over to plus,
and you can just put in, say plugindev, and it’ll
actually automatically name the site, say plugindev.dev. I did try naming it
plugin.dev on its own, but that’s actually a real site, apparently. So it conflicted with that. But yeah, if we call it
plugindev.dev and we can pick where we want it to appear on our machine. I actually create a Flywheel
folder within my home folder. So I’ll just select that. There we go. And you do have the option to
create a blueprint as well, if you’d like, but I
don’t have any, so I’ll just hit Continue. And now you can pick the
preferred environment, which in this case is PHP 7.1 at
the time of this recording. But, I’ll pick a custom one,
which gives me the option of a bunch of different PHP versions. And I’m gonna pick PHP
5.3, even though right now PHP 5.2, which hasn’t been
supported for a while, is the minimum requirement for WordPress. A lot of hosting companies
still use that old of a version. But personally, I support PHP 5.3 and up. So, if this is something
where you’re gonna be making it just for a
client, then you might wanna just stick with the default
preferred, depending on which hosting company they’re using. Otherwise, you can just pick this. And now, I’m able to test on kinda, the minimum required version. And it also forces me not to use any of the newer PHP stuff, which I’ll go through in the next video. And I’ll keep the web
server and mySQL version, which is the database, the same. Now here you can pick the WordPress Admin username and password. I’ll just leave it the
default, which is testing. And then the default
WordPress email, which doesn’t really matter,
because we’re not actually gonna send any emails
out into the real world. So, if I hit Add Site, it’ll
provision it, it’ll create it, it’ll ask for my root password. And once it’s good, it’ll
start up and give us a fresh WordPress installation
that we can start from. There we go. So it gives us the
database, so we can actually install this free Sequel
Pro, and see what’s actually in the database directly. We’ve got a bunch of
other utilities; MailHog, great name, I think, which
actually will kinda scoop up any emails that your
WordPress site, or your plugin sends, so you can actually
see what is being sent without, you know, having
to set up some kind of real email server somewhere. An SSL, if you’d like, you
can install that if you need to test something on
kind of a secure site. Otherwise, we can just hit View Site. And there you go. So, we’ve got a default
installation of WordPress, nothing on it, everything’s a default. It does strip out any and
all plugins, so there’s no actual plugins that are installed. But I can just head over to wp-admin. Log in using the username and
password I had put in before. And here we are. So, just dismiss that. But again, you can see we have no plugins. But in the rest of this course,
we’ll learn how to create a new plugin, and have it
appear here, activated, and do all that fun stuff. Now to actually create the
code for this; typically you don’t wanna just use
some text editor that comes with your operating system,
whether it be Windows, or Mac. I, much prefer PhpStorm. It is a paid program, but
it has a free 30 day trial, so you’re welcome to
download it, install it, and try it for the purpose
of this video course. Otherwise, there’s Sublime
Text, which is, a lot of people love this program, and there’s
courses and books on it, so you can learn how to do it. And there’s also textmate, which is… I’m not sure how updated it
is right now, but it’s one that I used for years. I still use it, yeah, even
though it’s saying that it’s an old version of
OSX; it still works for me. And again, gives you,
whichever one you use, you wanna make sure you get
the ability to have a whole listing, like here, of all your files. So you can then have all
your WordPress files, all your plugin files visible
so you can just click on it, edit it, have tabs. Same thing here, right? So we’ve got, you know,
the ability to have all these different folders
and files, so you can just see your entire project,
and then have multiple tabs, open other files. Whichever editor you use,
you wanna make sure it has those features, which PhpStorm does. PhpStorm as well, has the
ability to, you know, just kinda command, click and
actually go right to the code that you need to. So, it gives you a lot of
tools to make it easier to develop with. So, whichever one you pick,
you wanna download it, and then just open up a
new project, or create a new project. With PhpStorm you have the
option, Create a New Project From Existing Files, and you
would just pick that folder that we created our
plugindev.dev file, which should, by default, would be
the local site’s folder in your home directory. Otherwise, in my case, I
created a new Flywheel folder. Wherever you put it,
just open up those files, and we’ll be ready to
go for the next video.

Leave a Reply

Your email address will not be published. Required fields are marked *