The base WordPress plugin development environment

In order for you to play along, it’s important to be able to review and run what I’ve created. This involves being able to build and test code, or at least the ability to install and run it.

This will involve some work on your part, but if you’ve done any development, you’ll have an idea with regards to what you need to do when you understand it’s purpose.

Because this project is centered around using WordPress – by means of a plugin – the project is relatively contained. As you probably already know, plugins are the way you introduce 3rd party code to the WordPress environment. This allows for basic enhancements to your website without creating dependencies to core or theme-based code. They can be installed, activated, deactivated and uninstalled. Theoretically leaving no footprint after install.

Another nice thing about WordPress code is that it’s compiled and interpreted at runtime within the browser. This means that the files we’re going to modify are text based.

Also, most functionality can be developed in a local development environment and once tested, uploaded to your website. It’s rare that you actually dynamically build on a live website. That’s just bad form, but sometimes required.

What I use

Get yourself a hosting service that allows you to install WordPress in its raw form. You’ll need the ability to upload files to the actual WordPress directory on your hosting server. You’ll also need phpMyAdmin access to the associated database. After you install, take note of the \wp-content\plugins directory. That is where the plugin(s) will go.

The local development environment requires installing XAMPP Control Panel in order to have your development system provide localhost services. Basically, your system will simulate the server environment so you can test and run you plugin. The XAMPP environment is tightly integrated with phpMyAdmin. Like with the live internet hosted website, here, you’ll also need to use phpMyAdmin to manage your database.

Once you have the basic tools to simulate a server, you’ll need WordPress. Download the latest version. Now you’re going to need to install WordPress in a directory that XAMPP is expecting. Basically, when you run localhost\X in your browser, the XAMPP simulated server environment is going to capture the command and ‘run’ the X directory.

For this project, I have a directory labeled AmorStyle in the .\xampp\htdocs directory. Thus, I can run “localhost\amorstyle” in the browser of my development computer and my WordPress website is rendered in that local browser. When this happens, the ‘code’ is interpreted and run – allowing for debugging opportunities.

At this point, do what you can to run the same look & feel between your local website and the live server hosted site.

Modifying code

Because the plugin files are html, php, js and cs, you can use Notepad to modify the contents.

I use Visual Studio. Having an integrated development environment is not needed, but hard to work without. There are features build into development tools that are considered essential when doing real development work.

Running a plugin

As you investigate installing plugins, most plugins are installed from within WordPress itself. The backend admin pages of WordPress allow you to search and find official plugins that have been approved by the WordPress organization. In other words, they screen the plugins so they meet a relatively high standard (documented, tested, reviewed, etc). What you get here will be a little more raw.

As the project develops, I’ll probably revisit this post or blog about changes to my process. Some technologies will involve additional tools (or simulators) which will be called out as appropriate.