WordPress plug-in Development learning (a) HELLO World,wordpresshello
WordPress plug-in Development Learning Series first article, append the fixed character "Hello world" after each post
One. Open the WordPress directory->wp-content->plugins
Two. Create a new directory under Plugins 1100w-hello-world
Three. Create a new two files under 1100w-hello-world
1100w-hello-world.php plugin must file, plugin entry file. Place plug-in main function code. If the plugin contains more features, you can put the function code in a different PHP page, in this case, because only the Hello world is displayed, so the function code fat into the 1100w-hello-world.php code
Readme.txt If you need to share the plugin in the WordPress community, you need to use this file. When testing, but is not used to build.
After the setup is complete, the directory structure is as follows:
Four. Edit the 1100w-hello-word.php file, first enter the following code
/* Plugin name:hello-worldplugin uri:http://1100w.com/description: The simplest plug-in implementation, append Hello worldversion to each post: 1.0author:1100wauthor URI:HTTP://1100W.COMLICENSE:GPL*/?>
After the code is saved, open WordPress, into the background plug-in management, although not added to the function code, but you can see the plugin information we developed
The above comment code is the wordpress plugin description code, format fixed, each wordpress plugin must abide by. respectively corresponds to:
Plug-in Name
Plugin's official link
Plugin description
Version
Author
Author's official Link
Open Source Agreement
Five. Add the function code to the 1100w-hello-word.php
// add filter, execute Hello_world function when the_content display, append return data add_filter (' the_content ', ' Hello_world '// callback function hello_world ($content) { // detection is a single page. if (Is_single ()) { // add Hello World. return $content . ""; } Else { // If other pages are not processed. return$content; }}
Six. Activate the plugin, open a link, the plugin function is shown as follows:
http://www.bkjia.com/PHPjc/986993.html www.bkjia.com true http://www.bkjia.com/PHPjc/986993.html techarticle WordPress Plug-in Development learning (a) Hello World,wordpresshello wordpress Plugin Development Learning Series article one, append the fixed character after each post Hello world. Open W ...