Skip to content

Instantly share code, notes, and snippets.

@ramzesimus
Created October 1, 2012 15:01
Show Gist options
  • Save ramzesimus/3812302 to your computer and use it in GitHub Desktop.
Save ramzesimus/3812302 to your computer and use it in GitHub Desktop.
PHP: Plugin Implementing
// Run this code on 'after_theme_setup', when plugins have already been loaded.
add_action('after_setup_theme', 'my_load_plugin');
// This function loads the plugin.
function my_load_plugin() {
// Check to see if your plugin has already been loaded. This can be done in several
// ways - here are a few examples:
//
// Check for a class:
// if (!class_exists('MyPluginClass')) {
//
// Check for a function:
// if (!function_exists('my_plugin_function_name')) {
//
// Check for a constant:
// if (!defined('MY_PLUGIN_CONSTANT')) {
if (!class_exists('Social')) {
// load Social if not already loaded
include_once(TEMPLATEPATH.'plugins/my-plugin/my-plugin.php');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment