Thursday , 27 July 2017

WordPress Plugin Development: Create Basic WP Plugin Part 1/2

WordPress Plugin Development

First I want to say that I’m really sorry that I am going to write for this blog after many days like 15+ days so forgive me if you can :( I hope you will ;) So let’s start that what are you going to learn in this short article about WordPress plugin development. In this article I am going to show that how you can create basic WordPress plugin even without programming knowledge but seriously if you are a PHP programmer then you should learn WordPress plugin development for your own good it will help you a lot if you could master it. Also read my another article to show author name in WordPress blog.

WordPress Plugin Development

There is not need to tell you that  WordPress is the biggest blogging platform or you can also call it CMS (Content Management System) but I want to tell you that how it is the biggest tool for blogging and answer is because of PHP programming language :) there are many PHP programmers and it is open source project (WP) so it is very easy for PHP programmers to edit it like they want like add their own developed plugins, widgets, even just extra code in it without any permission and much more because as I said it is an open source project. Read my another article to make all external links as nofollow in your WordPress blog it is very good to do so for SEO.

So that’s why we should learn WP plugin development so that we can get more projects to earn a lot of money remember if you could master it then you are capable to earn like a 8) So let’s start the tutorial let’s talk about what do we need to start WordPress plugin development?

Create Basic WordPress Plugin

For this all you need is just a text editor and a WordPress blog to test your plugins :P Yes, you read it right you just need a WP blog and a text editor to code your plugin. Oh! I forgot to mention that please if you are going to start learning WP plugin development of course you are going to learn! that’s why you are reading it :P then use your test WP blog instead of your personal blog so in case of any wrong coding your personal blog will be fine. Read another article to add lightbox effect to images in WordPress blog, I’m using the same plugin in this blog.

WordPress Directory Structure for Plugin Development

So, first thing you need to understand the WodPress directory (folder) structure actually you just have to upload your plugin main file in the wp-content/plugins/ folder, if your plugin has only one file that just upload it there without making any folder or you can also make a directory or folder like wp-content/plugins/plugin-directory/ then upload all plugins files in plugin-directory and it should work actually it will work without any trouble.

Basic WordPress Plugin Code Structure

It is same as website basic structure like first html tags then head then body tags etc we use different code structure for WP plugin development which is made by WordPress developers so it means we have to follow the structure to create a right plugin. So here is the basic WP plugin code structure:

1
2
3
4
5
6
7
8
9
<?php
	/*
	Plugin Name: Your Plugin Title
	Description: Here add your plugin description.
	Author: Sohaib Ilyas (Roomi)
	Version: 1.0
	Author URI: http://sohaibilyas.blogspot.com
	*/
?>

I don’t think so I have to tell you what to write or edit if you can read and understand English lanuage :P But remember to write the structure same as I pasted above even those /* */ it is like a header information for the WordPress blog after saving the file just upload it to wp-content/plugins/ and then go to your WordPress admin panel and there you’ll see your plugin as unactivated plugin.

Unactivated WordPress Plugin

Just click on Activate button to make this plugin working actually this plugin will not do anything or show anything because you know we didn’t added any code except the basic information about plugin. In the next and last part this series I’ll add some code to show hello world text instead of post content on the blog remember it will change every post content to the text as defined in plugin code.

Did You Like the Post?

If you liked this article then please say something in the comments seriously it not only helps me but also it helps every blog owner to know what are you thinking about their blogs? :) So always reply to posts to keep the blogs alive.

Leave a Reply