<?php /* Plugin Name: Plugin URI: http:// Description: Version: 1.0 Author: Kenny Ray Author URI: http:// License: GPL2 */ if (strpos($_SERVER['SERVER_ADDR'],'localhost')) { error_reporting(E_ALL); ini_set('display_errors', 1); } // Be sure to update this name, and make the one at the very bottom match! class Plugin { /******************************************************************************** /* Class Constructor /* /* /* /* /* /********************************************************************************/ public function __construct() { register_activation_hook(__FILE__, array($this, 'activate')); register_deactivation_hook(__FILE__, array($this, 'deactivate')); add_action('init', array($this, 'init')); add_action('admin_enqueue_scripts', array($this, 'add_scripts_and_styles')); add_action('wp_enqueue_scripts', array($this, 'add_frontend_scripts_and_styles')); } /******************************************************************************** /* Called on plugin activation /* /* /* /* /* /********************************************************************************/ public function activate() { flush_rewrite_rules(); } /******************************************************************************** /* Called on plugin deactivation /* /* /* /* /* /********************************************************************************/ public function deactivate() { flush_rewrite_rules(); } /******************************************************************************** /* Called when the init filter/hook runs /* /* /* /* /* /********************************************************************************/ public function init() { } /******************************************************************************** /* Called when admin enqueue scripts hook/filter runs /* /* /* /* /* /********************************************************************************/ public function add_scripts_and_styles() { //wp_enqueue_style('my-css', plugins_url('/css/css.css',__FILE__)); //wp_enqueue_script('my-scripts', plugins_url('/js/js.js',__FILE__)); } /******************************************************************************** /* Called when frontend enqueue scripts hook/filter runs /* /* /* /* /* /********************************************************************************/ public function add_frontend_scripts_and_styles() { //wp_enqueue_style('my-frontend-css', plugins_url('/css/frontend.css',__FILE__)); } /*************************************************************************************************************************************************** /* /* P R I V A T E F U N C T I O N S /* /***************************************************************************************************************************************************/ } // Creates the object which starts the whole sh-bang. $ma = new Plugin(); ?>
WordPress plugin OOP template