Friday, August 29, 2014

My First WordPress Plugin - Tutorial Part 1

5:11 AM

WordPress Plugin is a set of one or more function that is particularly focused on performing certain task either adding a specific set of features or services to the WordPress weblog. It includes at least a PHP file and other files like css and javascript.

Step 1: Requirements

·         Familiar with basic functionality of WordPress and PHP programming
·         Installed WordPress with administrative privilege

Step 2: Folder Creation

The plugins for the WordPress are kept under the same location at wp_content/plugins. Create a folder with a unique name, the name of the folder should not coincide with other plugin name, as wp_content/plugins/your_plugin_folder_name . This folder is supposed to contain all the required files.

Step 3: File Creation

           Create a normal PHP file as index.php . The file contains the two sections:

3.1.       Plugin Detail

           The descriptions are provided as comment which contains the plugin’s name, description, version and author but there is no limitation to it. You can also add its URI, author URI and license.


The above information is used to display in the plugin section. 


3.2.       Plugin function

           This section is especially focused on the task as the plugin intend to perform. It contains atleast a function and may contain javascript and css files as per the complexity. As for example: a simple filter is shown below to add “Hello World. This is Semicolon Dev” at the end of the content of the pages.


Here, we have used the filter properties of WordPress with the function add_filter(); the filter takes two argument “the_content” which obtains the content of the post and next argument: a function name “helloworld”. This function adds “Hello World. This is Semicolon Dev” to the end of every post.

BEFORE PLUGIN ACTIVATION


AFTER PLUGIN ACTIVATION


Written by

We are passionate programmers. Enjoying the rich platforms of Semicolon Family of Programming languages we are proud to call ourselves Semicolon Developers.

0 comments:

Post a Comment

 

© 2013 Echo "Semicolon Developers"; Kathmandu. All rights resevered @ Semicolon Developers Network Pvt. Ltd.. Designed by Templateism

Back To Top