Last active
December 17, 2015 04:19
-
-
Save JiveDig/5550101 to your computer and use it in GitHub Desktop.
Create new plugin in WordPress.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: CUSTOM - Website Title | |
Plugin URI: http://thestizmedia.com | |
Description: All custom funtionality for www.Website_Title_Here.com | |
Version: 1.0 | |
Author: JiveDig | |
Author URI: http://thestizmedia.com | |
Copyright 2013 JiveDig ([email protected]) | |
*/ | |
// Exit if accessed directly | |
if ( !defined( 'ABSPATH' ) ) exit; | |
// Plugin and class main setup | |
if ( ! class_exists( 'My_Plugin_Name' ) ) { | |
class My_Plugin_Name { | |
public function __construct() { | |
/** Define plugin directory constants */ | |
define( 'MY_PLUGIN_NAME_CORE_DIR', dirname( __FILE__ ) ); | |
define( 'MY_PLUGIN_NAME_INCLUDES_DIR', MY_PLUGIN_NAME_CORE_DIR . '/includes/' ); | |
define( 'MY_PLUGIN_NAME_PLUGIN_NAME', dirname( plugin_basename( __FILE__ ) ) ); | |
} | |
/* Active and Deactivate the plugin */ | |
public static function activate() { | |
// Do nothing on activation | |
} | |
public static function deactivate() { | |
// Do nothing on deactivation | |
} | |
} | |
} | |
if ( class_exists('My_Plugin_Name' ) ) { | |
// Installation and uninstallation hooks | |
register_activation_hook( __FILE__, array( 'My_Plugin_Name', 'activate' ) ); | |
register_deactivation_hook( __FILE__, array( 'My_Plugin_Name', 'deactivate' ) ); | |
// instantiate the plugin class | |
$My_Plugin_Name = new My_Plugin_Name(); | |
} | |
/** Include core plugin files */ | |
require_once( MY_PLUGIN_NAME_INCLUDES_DIR . 'post-types.php' ); | |
/* require_once( MY_PLUGIN_NAME_INCLUDES_DIR . 'templates/some-file.php' ); */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment