Powered by Blogger.

WordPress plugin development


WordPress plugin development

1.Plugin Directory Structure:
Your Plugin:
● /wp-content/plugins/my-plugin
Inside “my-plugin”
● readme.txt
● screenshot-1.png
● my-plugin.php
Always put it in a directory!
Uses 'dashes' and not 'underscores'
2.my-plugin.php having four parts
● Plugin Header
● Hooks
● PHP Code
● Template Code
3. Plugin header example, always on top with your own detail
<?php
/*
 Plugin Name: Health Check
 Plugin URI: http://wordpress.org/extend/plugins/health-check/
 Description: Checks the health of your WordPress install
 Author: The Health Check Team
 Version: 0.1-alpha
 Author URI: http://wordpress.org/extend/plugins/health-check/
 Text Domain: health-check
 Domain Path: /lang
 */
4. Activate and deactivate the function
register_activation_hook(__FILE__, 'do_active');
register_deactivation_hook(__FILE__, 'do_deactive');
function do_active(){
//do something
}
function do_deactive(){
//do something
}
5. Actions and Filters (2 Kinds of WordPress Hooks)
Example:

http://www.elegantthemes.com/blog/tips-tricks/how-to-create-a-wordpress-plugin

https://www.airpair.com/wordpress/posts/developing-wordpress-plugin-from-scratch

http://corpocrat.com/2009/12/27/tutorial-how-to-write-a-wordpress-plugin/

No comments