Here is some steps To create a WordPress Plugin
1. Create a folder using your plugin name in wp-content/plugin directory
2. Create a file with same name as your plugin name
3. Write your all credential for plugin in your firest file
/*
Plugin Name: ravindrasearch
Plugin URI: http://ravindrasearch.com
Description: <strong>WordPress 3.5 + ONLY.</strong> Enhance your Search Engine and more.
Author: Ravindrasearch
Version: 1.0.0
Author URI: http://www.ravindrasearch.com/
CHANGELOG
See readme.txt
*/
these are the plugin Information
4. Add new plugin name in your setting menu using this line
add_action('admin_menu','ravindrasearch_admin_action');
this code should written in your first plugin file
5. Run this code and in admin panel and check that everything is working
6. Now we are using Ajax in Wordpress Plugin
7. Add Jquery in your file to use Ajex
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('http://code.jquery.com/jquery-1.8.2.js');
8. We are using Here core PHP so need to add these line in your wordpress Plugin
first line uses is to prevent direct access
second line is plugin directory assignment
3rd and 4th line are including files in plugin
5th and 6th line are used for Activate and deactivate your plugin from admin panel
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
define( 'ravindrasearch__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
require_once( ravindrasearch__PLUGIN_DIR . 'advanced-searchform.php' );
require_once( ravindrasearch__PLUGIN_DIR . 'advanced-search-result.php' );
register_activation_hook( __FILE__, 'pluginprefix_function_to_run' );
register_deactivation_hook( __FILE__, 'pluginprefix_function_to_run' );
9. This function will use to add code in your frontend
add_action('init', array('advanced-searchform', 'init'));
here init will add in frontend and advanced-searchform is a function
10. Now we are adding ajex in front end
wp_localize_script('ajax-request', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
this line is used to add ajex script here MyAjax is post method
1. Create a folder using your plugin name in wp-content/plugin directory
2. Create a file with same name as your plugin name
3. Write your all credential for plugin in your firest file
/*
Plugin Name: ravindrasearch
Plugin URI: http://ravindrasearch.com
Description: <strong>WordPress 3.5 + ONLY.</strong> Enhance your Search Engine and more.
Author: Ravindrasearch
Version: 1.0.0
Author URI: http://www.ravindrasearch.com/
CHANGELOG
See readme.txt
*/
these are the plugin Information
4. Add new plugin name in your setting menu using this line
add_action('admin_menu','ravindrasearch_admin_action');
this code should written in your first plugin file
5. Run this code and in admin panel and check that everything is working
6. Now we are using Ajax in Wordpress Plugin
7. Add Jquery in your file to use Ajex
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('http://code.jquery.com/jquery-1.8.2.js');
8. We are using Here core PHP so need to add these line in your wordpress Plugin
first line uses is to prevent direct access
second line is plugin directory assignment
3rd and 4th line are including files in plugin
5th and 6th line are used for Activate and deactivate your plugin from admin panel
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
define( 'ravindrasearch__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
require_once( ravindrasearch__PLUGIN_DIR . 'advanced-searchform.php' );
require_once( ravindrasearch__PLUGIN_DIR . 'advanced-search-result.php' );
register_activation_hook( __FILE__, 'pluginprefix_function_to_run' );
register_deactivation_hook( __FILE__, 'pluginprefix_function_to_run' );
9. This function will use to add code in your frontend
add_action('init', array('advanced-searchform', 'init'));
here init will add in frontend and advanced-searchform is a function
10. Now we are adding ajex in front end
wp_localize_script('ajax-request', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' )));
this line is used to add ajex script here MyAjax is post method
No comments:
Post a Comment