Building a WordPress plugin

This is not going to be an article, but a series of articles that should take me (and you, I hope), from zero to plugin development. In this series I will try to develop a plugin and present you the journey that I took in order to reach the final result. A lot of the things you see here, you may have seen in other places (and I will mention the sources I used in order to make the tutorials at the end of each tutorial), but still this is a journey that I’ve made.

The scope of the journey: Create a plugin that will allow users to create Marketo forms locally.
The idea: Considering that Marketo uses a lot of old code when we call a form, wouldn’t be a good idea to stop depending on that code and start developing the forms locally in WordPress? This way, we can develop the forms design any way we want to and we can also reduce the loading time of those forms, while sending them back to Marketo using REST API.

So let’s get to work.

We will start by creating our starter files. We can do that by hand, but there is an easier way by using the WordPress Plugin Boilerplate Generator (https://wppb.me). This creates the basic files needed in order to start developing a plugin from scratch with good practices and object-oriented style.

In order to avoid having headaches I would recommend you use a single word for your plugin name (“TheAwesomePlugin” maybe ? “TutorialPlugin” ?). Because I need to develop a plugin for Marketo, I will name mine “MarketoForms”.

After you complete the form, and push “Build Plugin”, you will download the plugin archive. Simply copy/paste the plugin from inside that archive into the plugins directory of your WordPress. Once you have the plugin in the plugins directory, go and activate the plugin from the admin section. If everything went ok, the plugin should be activated and you shouldn’t see anything out of ordinary.

Now… to the hard part.

Let’s suppose we want to have a settings page for our plugin. Let’s start by adding menu link to that settings page.

After we’ve created the menu that sends to our settings page, it’s time for us to create the necessary forms that will save our settings.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store