WordPress plug-in Development learning (a) HELLO world,wordpresshello_php tutorial

Source: Internet
Author: User

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 ...

  • Related Article

    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.