gamal-n
1/29/2018 - 10:44 AM

Plugin

<?php

#-----------------------------------------------------------------

# Check For Plugin Active

# Admin area
if ( is_plugin_active( 'plugin-directory/plugin-file.php' ) ) {
} 

# Front end
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'plugin-directory/plugin-file.php' ) ) {
}

# -----------------------------------------------------------------

# Urls && Paths

# Absolute paths and URLs within your PHP code

 plugin_dir_path();
 plugins_url();

# Example

 plugin_dir_path() . '/assets/css/main.css';
 plugins_url() . '/assets/js/main.js';


# -------------------------------------------------------------------

# Security

defined( 'ABSPATH' ) or die( 'No script kiddies please!' );

# -------------------------------------------------------------------


# readme.txt ( Why ? )

/*

If you want to host your Plugin on 

https://wordpress.org/plugins/, 

you need to create a readme.txt file within your plugin directory in a standardized format. 

You can use the automatic plugin 'readme.txt' generator.

https://generatewp.com/plugin-readme/

*/

# ---------------------------------------------------------------------------

/* 

The WordPress plugin repository uses the "Requires" and "Tested up to" versions 

from the readme.txt in the stable tag. 

*/