Mitul Dabhi
answered Nov 30 '-1 00:00
simply create folder(your-plugin-name) in wp-content/plugins
and create php file named same with your-plugin-name.php
header is must in landing file of the plugin like below
<?php
above is needed parameter for the header of the plugin file.
i skipped some.check more
and now you start the code at main file.
you can create more folder for admin or css or js
you can put the code at separate for admin and frontend
How to admin
use is_admin function to separate run for admin
if ( is_admin() ) {
$dir = plugin_dir_path( __FILE__ );
require_once( $dir. '/admin/admin-loader.php' );
}
admin/admin-loader.php never load untill we are in admin
Shortcode
add_shortcode( "my-short-code-label",'functionName');
function functionName(){
}
include [my-short-code-label] at post or page to include the code at functionName function