Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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