2 minutes read

Simplest WordPress plugins creation, Part 1.

There is no question WordPress is the most popular Content Management System, in the world of CMS possibly because of it’s simplistic and the free blog platform wordpress.com and support for several features; theming, plugins, widgets, media management and more being the most notable. I personally love SEO support that it comes with out of box.

Plugins-available-in-Wordpress-dot-org

WordPress.org has over 45k plugins!


Actually wordpress.org has ove 40,000 plugins and more are coming in. So why do I teach someone who to make a plugin? Simply because you may have an idea that is not yet executed though it could be useful to you and other WordPress users. So if you read this short tutorial and other parts, you will be able to do that whenever you want.
Tip: WordPress plugins can be monetized hence make some income for you.

Prerequisite knowledge you should have/know.

It’s important to check yourself for the technologies below.

  • HTML, CSS & PHP knowledge (Must)
  • Javascript/Jquery/Angular knowledge is a plus
  • A text editor such as Notepad++, Brackets & Sublime, etc.
  • A fully working WordPress installation, running on a local/private server. Testing on local(development) set up, is recommended in order not harm the website the visitors are viewing.

Step 1. In a folder of your choice, create a main PHP file of your plugin and name it. e.g my_plugin.php
For preview purposes, I suggest to create a folder, residing in the WordPress plugin folder.
Which is located at /wordpress_install_folder/wp-content/plugins
If you have xampp installed on your development machine, you have this folder in the path; c:/xampp/htdocs/wordpress_install_folder/wp-content/plugins
Step 2: Add plugin code to the file

a.Tell WordPress about your Plugin

A WordPress plugin begins with code that describes the plugin, they code is so helpful for installation, uninstall and management of the plugin. It also makes extending the plugin or updating it’s code easier. Such details include:- Plugin Name, Description, Tags, Author, Version, Author URI and etc. As a general rule of thumb this code goes at the start of the file, enclosed in comments.
Example:
/*
Plugin Name: My Plugin
Author: awebdesigner
Author URI: http://fictiontoactual.wordpress.com
Description: My Plugin is a cool plugin and it will print the date at the footer of website. For illustration purposes.
Version: 0.0.1
*/
b. Add code to do the real thing
add_action(‘wp_footer’,’print_date’);
function print_date(){
echo date(‘Y’);
}
Step 3: Compress and upload to server.
Let see it in action. Compress the plugin and upload it to your site.
Notice: Since WordPress is coded using PHP, it’s plugins supports everything PHP supports, includes, services, MYSQL etc. Don’t limit yourself.
What’s next? Improving the functionality of our WordPress Plugin by adding to the Admin Menu, integrating a form which saves something and display to the users.
 

Sharing is caring

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on whatsapp
WhatsApp
Share on email
Email

You may also like this

When not to use a forEach loop in JavaScript

A forEach loop is one of the most optimized JavaScript Higher-Order functions that make it one of the preferred functional programming languages. What is a Higher-Order function? It is a function which takes in another function (also called a callback)

Read More »
Thoughts

You are not about to die poor.

In recent years, the biggest number of people I have met are characterized by the following;- Lazy Not ready Entitled Ignorant Dishonest Inconsistent It sounds unfortunate, that most probably you will meet people of similar characteristics or more if you’ve

Read More »
Thoughts

Thoughts on 13-06-2019

I promised to share my thoughts in any possible way. In fact, am happy to be honoring you, my readers, that today by sharing something that could be life changing to some. Please, I request you to converse through the

Read More »
Thoughts

A beautiful thought for 29-05-2019

Hey beloved, Once in a while, I develop thoughts in my head, and instead of keeping them to myself I’ve decided to share them. Who knows who it will help? By the way, at the bottom of the post, is

Read More »