Lesson 04: What is WordPress Plugin? WordPress plugin structure

View: 407    Dowload: 0   Comment: 0   Post by: admin  
Author: none   Category: WordPress template   Fields: Other

19 point/3 review File has been tested

As we know WordPress is an open source CMS helps manage content with ease. Formerly known as WordPress CMS used to build a blog, but now the power of WordPress does not stop at a regular blog that you can use WordPress to build most types of web sites such as referral , web sales and web news.

Introduction

When you install WordPress, the default it will be a normal blog, and you can use a different layout combined with Template Tags to dump data into the new layout, however this work stopped at instead can not change the interface adds functionality of websites. So gradually reveal problems before, right? Now if I want to be a sales site, then how? Maybe not on the WordPress Core to change, this is not good nao.Vay to solve problems on the WordPress provides a function similar to the software that is installed plugin WinForms.

1. What is WordPress Plugin?

WordPress Plugin is a module handling a certain function and modules that use the WordPress API provided to intervene in Core instead of direct editing in the Core. Each plugin can have multiple file PHP, JS, CSS and boil down we have a common purpose of which is to meet a specific function in the Website. Currently on the home page has more than 11 thousand of WordPress plugins and we are increasing over time, you can easily search for a specific plugin very easily by providing your keyword.

We split into two objects use the plugin as follows:

    
The developers of plugins: This object based on the requirements of functionality combined with programming knowledge to build WordPress plugin, after the construction is finished they can sell or public free of charge for users.
    
Users plugins: This object simply find suitable plugin is activated and can be used.

You're liable to do?

If you are eligible for all users then this plugin is for reference only, which means you only need to read to know is to be. But if you're a developer, it requires that you plug into the knowledge that sport in this series alone mentioned. So keep an eye on each post to have a solid foundation offline.
 
Summary
In summary plugin in WordPress is an expansion module to solve a problem, a particular function. For example, you need to create a sales website, you will create a plugin for sale, you need to create your website, you create a plugin comic books, so the latter wish to create multiple websites or sales story then please install plugin that's been rather than take the code from scratch.
 
2. The structure of the WordPress plugin
 
Each plugin PHP file is not in a folder or an external php file located at the bow of the wp-content / plugins.

For example, you need to create a plugin called wp-learn, then we will create a folder in the folder wp-content / plugins and a file named wp-learn.php (see picture).

The next step you need to report information in the wp-learn.php plugin anymore, the new WordPress identified offline. Structured as follows:

/**
Plugin Name: Tên Plugin
Plugin URI: URL Plugin trên wordpress.org
Description: Mô tả cho plugin
Author: Tên tác giả
Version: Version plugin
Author URI: Trang web tác giả
*/

Ok, now you will write content for your wp-learn.php as follows:

<?php
/**
Plugin Name: Learn WordPress
Plugin URI: http://freetuts.net
Description: Plugin dùng để học WordPress
Author: Nguyễn Văn Cường
Version: 1.0
Author URI: http://freetuts.net
*/

Now you go to the WordPress admin menu and select Plug-ins -> Installed Plugins will see the interface as follows:

Part highlighted in red is the plugin that we've written, you click on the word that I have underlined Activate to activate this plugin. Because this plugin not present what code should still enable normal WordPress not guilty.

For clarity, you open the file in a folder akismet.php wp-content / plugins / Akismet will find the following content:

<?php
/**
 * @package Akismet
 */
/*
Plugin Name: Akismet
Plugin URI: http://akismet.com/
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet plan</a> to get an API key, and 3) Go to your Akismet configuration page, and save your API key.
Version: 3.1.10
Author: Automattic
Author URI: http://automattic.com/wordpress-plugins/
License: GPLv2 or later
Text Domain: akismet
*/
 
/*
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 PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
Copyright 2005-2015 Automattic, Inc.
*/
 
// Make sure we don't expose any info if called directly
if ( !function_exists( 'add_action' ) ) {
    echo 'Hi there!  I\'m just a plugin, not much I can do when called directly.';
    exit;
}
 
define( 'AKISMET_VERSION', '3.1.10' );
define( 'AKISMET__MINIMUM_WP_VERSION', '3.2' );
define( 'AKISMET__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'AKISMET_DELETE_LIMIT', 100000 );
 
register_activation_hook( __FILE__, array( 'Akismet', 'plugin_activation' ) );
register_deactivation_hook( __FILE__, array( 'Akismet', 'plugin_deactivation' ) );
 
require_once( AKISMET__PLUGIN_DIR . 'class.akismet.php' );
require_once( AKISMET__PLUGIN_DIR . 'class.akismet-widget.php' );
 
add_action( 'init', array( 'Akismet', 'init' ) );
 
if ( is_admin() ) {
    require_once( AKISMET__PLUGIN_DIR . 'class.akismet-admin.php' );
    add_action( 'init', array( 'Akismet_Admin', 'init' ) );
}
 
//add wrapper class around deprecated akismet functions that are referenced elsewhere
require_once( AKISMET__PLUGIN_DIR . 'wrapper.php' );

Temporarily we are not interested in what it writes only interested in introducing plugin code as follows:

/**
 * @package Akismet
 */
/*
Plugin Name: Akismet
Plugin URI: http://akismet.com/
Description: Used by millions, Akismet is quite possibly the best way in the world to <strong>protect your blog from spam</strong>. It keeps your site protected even while you sleep. To get started: 1) Click the "Activate" link to the left of this description, 2) <a href="http://akismet.com/get/">Sign up for an Akismet plan</a> to get an API key, and 3) Go to your Akismet configuration page, and save your API key.
Version: 3.1.10
Author: Automattic
Author URI: http://automattic.com/wordpress-plugins/
License: GPLv2 or later
Text Domain: akismet
*/
So this is the MUST HAVE ALWAYS code in your WordPress plugin offline.
 
3. Conclusion
 
Through this article you already know what is WordPress plugin and a basic structure of WordPress. This is the first in a series should learn advanced WordPress nothing lacking desire for sympathy and positive comments.

Note that since the next post I will use this plugin to demo examples you are offline.

Lesson 04: What is WordPress Plugin? WordPress plugin structure

Lesson 04: What is WordPress Plugin? WordPress plugin structure Posted on 28-04-2016  As we know WordPress is an open source CMS helps manage content with ease. Formerly known as WordPress CMS used to build a blog, but now the power of WordPress does not stop at a regular blog that you can use WordPress to build most types of web sites such as referral , web sales and web news. 6.3333333333333/10 407

Comment:

To comment you must be logged in members.

Files with category

 

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd