mirror of
https://github.com/inretio/WordPress-Plugin-Boilerplate
synced 2024-12-22 20:03:53 +02:00
commit
a59d520420
15 changed files with 30 additions and 25 deletions
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
@ -71,17 +71,18 @@ class PluginName {
|
||||||
// Add the options page and menu item.
|
// Add the options page and menu item.
|
||||||
// add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ) );
|
// add_action( 'admin_menu', array( $this, 'add_plugin_admin_menu' ) );
|
||||||
|
|
||||||
// Enqueue admin styles and scripts.
|
// Load admin style sheet and JavaScript.
|
||||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
|
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
|
||||||
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
|
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
|
||||||
|
|
||||||
// Enqueue public style and scripts.
|
// Load public-facing style sheet and JavaScript.
|
||||||
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
|
||||||
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
||||||
|
|
||||||
// Define custom functionality. See http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters
|
// Define custom functionality. Read more about actions and filters: http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters
|
||||||
add_action( 'TODO', array( $this, 'action_method_name' ) );
|
add_action( 'TODO', array( $this, 'action_method_name' ) );
|
||||||
add_filter( 'TODO', array( $this, 'filter_method_name' ) );
|
add_filter( 'TODO', array( $this, 'filter_method_name' ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,6 +93,7 @@ class PluginName {
|
||||||
* @return object A single instance of this class.
|
* @return object A single instance of this class.
|
||||||
*/
|
*/
|
||||||
public static function get_instance() {
|
public static function get_instance() {
|
||||||
|
|
||||||
// If the single instance hasn't been set, set it now.
|
// If the single instance hasn't been set, set it now.
|
||||||
if ( null == self::$instance ) {
|
if ( null == self::$instance ) {
|
||||||
self::$instance = new self;
|
self::$instance = new self;
|
||||||
|
@ -128,6 +130,7 @@ class PluginName {
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function load_plugin_textdomain() {
|
public function load_plugin_textdomain() {
|
||||||
|
|
||||||
$domain = $this->plugin_slug;
|
$domain = $this->plugin_slug;
|
||||||
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
|
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
|
||||||
|
|
||||||
|
@ -136,7 +139,7 @@ class PluginName {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueue admin-specific style sheets.
|
* Register and enqueue admin-specific style sheet.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
|
@ -156,7 +159,7 @@ class PluginName {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueue admin-specific JavaScript.
|
* Register and enqueue admin-specific JavaScript.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*
|
*
|
||||||
|
@ -176,7 +179,7 @@ class PluginName {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueue public-facing style sheets.
|
* Register and enqueue public-facing style sheet.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -185,7 +188,7 @@ class PluginName {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enqueues public-facing script files.
|
* Register and enqueues public-facing JavaScript files.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
@ -199,6 +202,7 @@ class PluginName {
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public function add_plugin_admin_menu() {
|
public function add_plugin_admin_menu() {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
*
|
*
|
||||||
|
@ -213,6 +217,7 @@ class PluginName {
|
||||||
$this->plugin_slug,
|
$this->plugin_slug,
|
||||||
array( $this, 'display_plugin_admin_page' )
|
array( $this, 'display_plugin_admin_page' )
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -249,4 +254,5 @@ class PluginName {
|
||||||
public function filter_method_name() {
|
public function filter_method_name() {
|
||||||
// TODO: Define your filter hook callback here
|
// TODO: Define your filter hook callback here
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: TODO 1.0.0\n"
|
"Project-Id-Version: TODO 1.0.0\n"
|
||||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/plugin-boilerplate\n"
|
"Report-Msgid-Bugs-To: http://wordpress.org/tag/plugin-name\n"
|
||||||
"POT-Creation-Date: 2013-05-10 11:23:19+00:00\n"
|
"POT-Creation-Date: 2013-05-10 11:23:19+00:00\n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
@ -18,18 +18,18 @@ msgstr ""
|
||||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||||
"X-Poedit-SearchPath-0: .\n"
|
"X-Poedit-SearchPath-0: .\n"
|
||||||
|
|
||||||
#: plugin-boilerplate.php:273
|
#: plugin-name.php:273
|
||||||
msgid "Page Title"
|
msgid "Page Title"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: plugin-boilerplate.php:274
|
#: plugin-name.php:274
|
||||||
msgid "Menu Text"
|
msgid "Menu Text"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: plugin-boilerplate.php:275
|
#: plugin-name.php:275
|
||||||
msgid "read"
|
msgid "read"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: plugin-boilerplate.php:276
|
#: plugin-name.php:276
|
||||||
msgid "plugin-name"
|
msgid "plugin-name"
|
||||||
msgstr ""
|
msgstr ""
|
|
@ -12,30 +12,29 @@
|
||||||
*
|
*
|
||||||
* @wordpress-plugin
|
* @wordpress-plugin
|
||||||
* Plugin Name: TODO
|
* Plugin Name: TODO
|
||||||
* Plugin URI: TODO
|
* Plugin URI: TODO
|
||||||
* Description: TODO
|
* Description: TODO
|
||||||
* Version: 1.0.0
|
* Version: 1.0.0
|
||||||
* Author: TODO
|
* Author: TODO
|
||||||
* Author URI: TODO
|
* Author URI: TODO
|
||||||
* Author Email: TODO
|
|
||||||
* Text Domain: plugin-name-locale
|
* Text Domain: plugin-name-locale
|
||||||
* License: GPL-2.0+
|
* License: GPL-2.0+
|
||||||
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
||||||
* Domain Path: /lang/
|
* Domain Path: /lang
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// If this file is called directly, abort.
|
// If this file is called directly, abort.
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'WPINC' ) ) {
|
||||||
exit;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: replace `class-plugin-boilerplate.php` with the name of the actual plugin's class file
|
// TODO: replace `class-plugin-name.php` with the name of the actual plugin's class file
|
||||||
require_once( plugin_dir_path( __FILE__ ) . 'class-plugin-boilerplate.php' );
|
require_once( plugin_dir_path( __FILE__ ) . 'class-plugin-name.php' );
|
||||||
|
|
||||||
// Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
|
// Register hooks that are fired when the plugin is activated, deactivated, and uninstalled, respectively.
|
||||||
// TODO: replace PluginName with the name of the plugin defined in `class-plugin-boilerplate.php`
|
// TODO: replace PluginName with the name of the plugin defined in `class-plugin-name.php`
|
||||||
register_activation_hook( __FILE__, array( 'PluginName', 'activate' ) );
|
register_activation_hook( __FILE__, array( 'PluginName', 'activate' ) );
|
||||||
register_deactivation_hook( __FILE__, array( 'PluginName', 'deactivate' ) );
|
register_deactivation_hook( __FILE__, array( 'PluginName', 'deactivate' ) );
|
||||||
|
|
||||||
// TODO: replace PluginName with the name of the plugin defined in `class-plugin-boilerplate.php`
|
// TODO: replace PluginName with the name of the plugin defined in `class-plugin-name.php`
|
||||||
PluginName::get_instance();
|
PluginName::get_instance();
|
Before Width: | Height: | Size: 450 KiB After Width: | Height: | Size: 450 KiB |
Loading…
Reference in a new issue