Skip to content

Instantly share code, notes, and snippets.

@bradyvercher
Last active April 22, 2016 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradyvercher/dde7306ba472fec8a39f to your computer and use it in GitHub Desktop.
Save bradyvercher/dde7306ba472fec8a39f to your computer and use it in GitHub Desktop.
<?php
/**
* Plugin Name: My Plugin
* Plugin URI: https://gist.github.com/bradyvercher/dde7306ba472fec8a39f
* Version: 1.0.0
* Author: Cedaro
* Author URI: http://www.cedaro.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
function myplugin() {
static $instance;
if ( null === $instance ) {
$instance = new MyPlugin_Plugin();
}
return $instance;
}
myplugin()->set_basename( plugin_basename( __FILE__ ) )
->set_directory( plugin_dir_path( __FILE__ ) )
->set_file( __FILE__ )
->set_slug( 'myplugin' )
->set_url( plugin_dir_url( __FILE__ ) );
myplugin()->register_hooks( new MyPlugin_Provider_I18n() );
add_action( 'plugins_loaded', array( myplugin(), 'load' ) );
<?php
/**
* Hooks.
*
* @package MyPlugin
* @copyright Copyright (c) 2016, Cedaro, LLC
* @license GPL-2.0+
* @since 1.0.0
*/
/**
* Hooks class.
*
* @package MyPlugin
* @since 1.0.0
*/
class MyPlugin_Hooks {
/**
* Register hooks.
*
* @since 1.0.0
*/
public function run() {
}
}
// Don't do this in the same file where the class is defined.
$myhooks = new MyPlugin_MyHooks();
$myhooks->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment