Start Your First Plugin Project with WPPB.me

I think the reason I was scared to create a plugin before was because I thought that the setup would be a pain to do. Looking at other successful plugins, I saw that they often had folders upon folders of organized files and extremely well-structured code.

But it really wasn’t the complexity that put me off. It was the fact that I had to start from essentially nothing. This meant I had a lot of questions to answer even before typing my first line of code.

Should I organize files by type or by function? What framework should I follow? Do I really need a separate folder for each type of file?

So you can imagine my relief when I found that you don’t have to set up all the folders and files manually. Just use the WordPress Plugin Boilerplate Generator.

WordPress plugin boilerplate generator

Step 1: Generate the Plugin Zip File

To create a plugin with all the needed files, you just need to fill in the form. In return, it sends you a zip file with all the things you need to make your plugin work. All the files themselves explain what they do which is a nice bonus.

First, let’s talk about the parts of the form:

  • Plugin Name. This is the name of the plugin that will show up when you install the plugin.
  • Plugin Slug. This is the code-friendly name of the plugin. The slug is used as the filename of your main plugin file, as well as an identifier of some of the other important files in it. Since I’ll be referring to this a lot, let’s call it “{plugin-slug}“.
  • Plugin Uri. This is the link to your plugin’s website. I suggest you use the link to your personal site or company’s site here for now unless you already have a website for the plugin itself.
  • Author Name. Enter your name here, or the name of your company
  • Author Email. Enter the email you want to share as part of the plugin. Note that this will be accessible to the users of your plugin so make sure it’s an email you want to share with the public.
  • Author Uri. Add the link to your personal website or company site here.

Step 2: Download and Unzip the File

Once you download the zip file, you’ll need to unpack it to edit the files so that you can add the functionality you need. For the next discussion points, keep in mind that we’ll use “{plugin-slug}” as a placeholder for the Plugin Slug you entered above.

After you’ve unzipped the file, you’ll see a lot of folders and files in it. Let’s focus on the important files and folders first and discuss the others later:

  • {plugin-slug}.php. This is the main file of the plugin. It’s what WordPress uses to build the description of your plugin when added it to the user’s plugin page. We can actually add the code needed to make the plugin work right here, but I think it would be better to modify the files below instead.
  • admin. This folder is where the admin part of your plugin lives. That includes your plugin options, internal menus found in the WordPress admin area, and so on. You’ll add the code in the  class-{plugin-slug}-admin.php file found here.
  • public. This folder is where the public-facing part of your plugin will be. If you change the way your blog looks, you need to add the code for that in class-{plugin-slug}-public.php.

Now I mentioned that you don’t want to modify {plugin-slug}.php directly. That’s because you want to make it easy to find the code you need if and when you need to modify it.

From my experience, adding all the code into one file can turn into a huge mess. Much better if you put the admin-facing code in the admin folder, and the public-facing code in the public folder. The generator even separates the files by type within each of those folders.

testing your plugin

Step 3: Testing Your Plugin

Obviously, the plugin doesn’t do anything right now. Let’s add a bit of test code now and add the plugin to your site to check if it works.

  1. Go to the admin folder of your plugin and open class-{plugin-slug}-admin.php using your favorite text editor, either NotePad for Windows users or TextEdit for Mac users.
  2. Look for this line:
    $this->version = $version;
  3. In the next line after that, type in this text:
    add_action('admin_head', function() { echo '<style>body{background:gold;}</style>'; });

    then, save the file.

  4. Go to the top folder of your plugin and turn it into a zip file. Often, you’ll just need to right click on the folder and choose the necessary menu item.
  5. After that, open up your site and go to the admin area. Navigate to Plugins > Add New.
  6. Click Upload Plugin at the top of the page, then click on Browse and upload the zip file you made earlier.
  7. Click Install Now and then click Activate Plugin.

admin area

If the background of your admin area is now in bright gold like the one shown above, congrats! You’ve just installed your first working plugin! Just deactivate it to revert to your normal color and uninstall it if you’d like.

PS: If you’re having trouble uploading the plugin, you might want to ask for some help from your site admin.

Now that you’ve made your first plugin, it’s time to modify it to add the features you want. But first, let me teach you a couple of things that will help you code better: creating a local WordPress setup for coding offline and how to edit your plugin’s code.

Getting Ideas for Your First WordPress Plugin

Have I convinced you to write your own plugin yet? If not, jump back and read my previous blog post.

Making something from scratch isn’t easy. Especially if it’s something you haven’t done before.

Here’s a hint to get your first plugin idea: build something that you need.

Tip #1: Build a Plugin You Need

You have your own WordPress site so you know all the kinks and compromises you make just to get stuff to work. What if you had a way to make those annoyances go away?

That would be a great first plugin project, actually. It’s simple enough that you should be able to hammer out a solution within a week. But it’s also helpful enough that you’ll be motivated to finish it, especially if the issue keeps bugging you time and again.

Some ideas on what to fix:

  • Move (or remove) a menu from the admin area of your site.
  • Add info you look up often right into your Dashboard
  • Change some default text on your site, like turning “Post Comment” into “Give a Suggestion”.

Tip #2: Build a Plugin Someone Else Needs

I’m pretty sure Tip #1 is enough for most folk but if you’re the helpful sort, then building something for somebody else might be more motivating for you.

Your plugin might be something that fixes a recurring annoyance for users of your site, whether they be your assistants, admins or site visitors. Or it can be something that improves their experience by adding a small feature.

You can also survey some friends who are also WordPress site owners for issues they have with their site. Then, add those ideas to your make-into-a-plugin list.

Of course, you’ll have to talk to these people to get the ideas out of them. Often, people don’t have any clue about what bugs them about something so you really need to dig deep to figure out what the issue is. The good thing is that a friendly chat or talk over coffee should sort things out.

Tip #3: Build a Plugin Everyone Needs

While I think this tip is the one that will help you make a plugin with the greatest impact, it’s also the trickiest one. You don’t want to solve a huge problem right away as your first plugin project.

BUT if you already have a few web development projects under your belt, by all means dive into making something that will help lots of folks. Here’s a few things that I think most WordPress owners worry about:

  • Having to create new content all the time
  • Finding out how to drive traffic to the site
  • Converting visitors into subscribers into customers
  • Making money from existing content on the site
  • Making sure the site “just works”, whether it’s on a phone or laptop, after updating, and after installing new plugins.

When I made my plugin, my first thought was how to solve the content creation problem of WordPress owners. We’re too busy building our businesses to blog (never mind the fact that blogging also builds the business). So I set out to make something that automatically creates new content from existing blog posts.

But apparently, most people don’t just need content but also people reading the content. That’s when I added a way to collect email addresses from people who wanted to grab that new content. Two birds with one stone!

pick WordPress plugin ideas you want built

Pick a Plugin Idea That You REALLY Want Built

With the three tips above, you should have collected enough ideas that you won’t have trouble trimming them down to something you’d really want to work on.

I believe that more than half the work that goes into making something new is ensuring you have enough motivation to finish the work you started.

So make sure your idea is something you really would like to work on and really want to solve. It should also be challenging enough so that you won’t be bored by its simplicity or frustrated by making something too complex.

But if there’s anything I’ve learned, making the plugin super simple is a challenge enough. So try to distill the idea into its very basic form. I have no doubt that it will become complex enough to satisfy you once you start working on it.

The main thing is that you start with just one idea. Then, we can start your first plugin project!

If you need help coming up with a plugin idea, don’t hesitate to reach out to me via the comments below, email me or send me a message.