WordPress plugin creation tutorial (1): How to Create a plugin

Source: Internet
Author: User

In the previous article, I wrote an overview of the WordPress plug-in creation tutorial according to the previous tutorial process. From this article, I will explain the WordPress plug-in production content. This article mainly describes how to create a plug-in.

I believe everyone knows where the plug-in Installation File is. That's right, in WP-content-> plugins, all the plug-ins we have installed are stored in this folder. When we first set up a WordPress website, two plug-ins are provided by default. One is akismet (the plug-in for filtering spam comments) and the other is Hello (the plug-in for displaying lyrics ). You can open the hello. php file. This plug-in is equivalent to the portal for creating the plug-in. You can see how to create a plug-in by viewing the content. As follows:

<? PHP/*** @ package hello_dolly * @ version 1.6 * // * plugin name: Hello dollyplugin URI: http://wordpress.org/plugins/hello-dolly/description: this is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words into most famously by Louis Armstrong: Hello, Dolly. when activated you will randomly see a lyric from <cite> Hello, Dolly </CITE> In the upper right of your admin screen on every page. author: Matt mullenwegversion: 1.6 author URI: http://ma.tt/#// the plug-in name, plug-in URL, plug-in description, plug-in author, plug-in version, and author address are listed above. these contents are enclosed by '/**/' annotations.

Note that the plug-in name and plug-in folder name you created must be unique and unique, so as to avoid conflicts with other plug-ins. You can go to Google or Baidu to verify whether the name is unique. There is also a plug-in name that you get to let others know what your plug-in is doing. The folder name cannot use a Chinese name. The following is a brief description of the process.

First, you need to consider the complexity of the plug-in. If it is very simple, you can directly create a file. If there are many files involved, you need to create a folder. Either type requires name uniqueness, such as creating a plug-in folder named my_plugin, and then creating the following information in the file.

/*** @ Package hello_dolly * @ version 1.6 * // * plugin name: My pluginplugin URI: http://www.myplugin.comDescription: My first WP plug-in Author: mynameversion: 1.0 author URI: http://www.cnblogs.com/fxmbzw */

The standard plug-in information must have at least the plug-in name so that WordPress can identify your plug-in. Other information is displayed on the control panel plug-in management page. Standard plug-in information has no requirements on the order of each line. After the plug-in is created, the plug-in you just created will appear in your background. In this way, even if your plug-in is successfully created, you can add copyright information under the plug-in information.

/* Copyright year author name (Email: Your mailbox) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the license, or (at your option) any later version. this program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a participant purpose. see the GNU General Public License for more details. you shoshould have written ed a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, inc ., 51 Franklin St, fifth floor, Boston, MA 02110-1301 USA */

If you want to submit the plug-in to the WordPress official website, or give users a good description. You can add a file named readme.txt. This section describes plug-in functions, installation methods, instructions for use, applicable Wordpress versions, and plug-in updates.

Plug-ins are easy to create. You can add other content based on your habits and needs. For example, you can write an HTML page to introduce your plug-in. There is also a lot of research on the writing of existing plug-ins before you start to make plug-ins. The production methods of each plug-in are ever-changing. If there are good methods, make a timely summary. In this way, we can avoid many detours in the development process.

 

WordPress plugin creation tutorial (1): How to Create a plugin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.