What Is a Plugin and Should I Build One?

What are plugins?

Plugins extend the functionality of WordPress. By adding a plugin to your site, you are adding a program that took hundreds of hours to create. What is it made up of? A plugin is created with straight up code and typically ties into WordPress.

What can plugins do?

  • Add a calendar to your website.
  • Help you to import hundreds of products from an Excel sheet.
  • Easily manage hundreds of products in an Excel-like format.
  • Add visually appealing image effects like slideshows.
  • Add chat support.
  • Improve SEO.

I have a list of all the plugins I’ve used and my favorite plugins.

Should I build a plugin?

Short answer: yes! I will answer that question by showing you how incredibly easy it is build one.

HOW Can I Build a Plugin?

Building a plugin is incredibly easy. As a friend put it, a plugin is simply another functions.php file. Let’s create one.

Create a folder called plugin-one, and a file called plugin-one.php to it. Add the text below to it.

Plugin Name: Plugin One

Yes, that is all you need to create a plugin: the plugin name. Of course, if you’re going to redistribute it, there’s a lot more that you have to include and do, but if you’re the only person that will use this plugin, why clutter it with unnecessary information and make things more difficult on yourself?

If you’re going to redistribute it, check out the official WordPress documentation on building a plugin. Always do things the WordPress way if possible.

Now, what can we do with our plugin? Well, when a programmer first learns a new language or new skill, it’s customary to echo out “hello world”.

Modify your plugin to include the echo statement.

 * Plugin Name: Plugin One

add_shortcode('call_hello_function', 'hello_function');

function hello_function() {
    return "Hello, World!";

You may be wondering “What in the world is going on?” I would be too. Well, anyone who has used WordPress has probably used a shortcode. Here, we are going to create a shortcode. We are creating a shortcode called call_hello_function that we can use on any page.

Okay, now, go ahead and zip (or compress if you’re on a Mac) that folder. Go to the WordPress dashboard, hover over Plugins and click Add New. At the very top of the page, click Upload Plugin. Click Choose File and navigate to the folder you just zipped. Click Okay, and then click Activate Plugin. Now, go to any page you want and paste the shortcode [call_hello_function] anywhere you want. Now, you should see “Hello, World!” echoed out wherever you put that shortcode.

See how incredibly easy that was??? Okay, maybe it wasn’t that easy, but congratulations!

Let’s create something a little more useful.

More Useful Plugin

 * Plugin Name: Plugin One

add_shortcode('get_blog', 'get_blog_function');

function get_rmcf_blog_post($atts) {
  $a = shortcode_atts( array(
      'post_id' => ''
  ), $atts );
  $post_id = $a['post_id'];

  $post = get_post( $post_id );
  $img_url = get_the_post_thumbnail_url($post_id);
  $post_title = $post->post_title;
  <div class="post">
    <img src="<?php echo $img_url; ?>">
    <h3><?php echo $post_title; ?></h3>
    <p><a href="<?php echo get_permalink($post_id); ?>">View Post</a></p>
  $my_post = ob_get_clean();
  return $my_post;


I know. It’s a lot. Basically, we are grabbing a post with its ID and displaying it wherever we use that shortcode.

WHEN Should I Build a Plugin?

Now, the real question here is, do you really need to put that code in a plugin? The answer to that is “not really.” You could just as well put that code in your functions.php file. Let’s try that. Let’s put the code in our functions.php file and see if it makes any difference. As you can probably guess, it did not make any difference. The shortcode works just the same.

Nine times out of ten, if you’re not sure if it should go in a plugin or your functions.php file, it can just as well go in your functions.php file. So, WHEN should you use a plugin instead of plopping the code in your functions.php file? Here are a few situations where I’ve opted to use a plugin.

Examples of Plugins I Built

Time Zone

This plugin does the same thing except it returns time zones.

Simple Popup Content

This is a “simple” little plugin that helps you to create popups. I actually published this plugin to WordPress if you want to download it and look at the code. This is probably my only plugin that deeply ties into WordPress.


This is a pretty complicated plugin that uses a jQuery calendar and an API from Mobile Town Guides.

Country Codes

This plugin uses user input to grab data from an API.

Surf Conditions

This plugin grabs data about surf conditions from an API. You can also download it from the WordPress plugin repo, but it’s a pain to set up and only useful if you live on the coast. I used it on a site called Dockside Divers.