mirror of
https://github.com/inretio/WordPress-Plugin-Boilerplate
synced 2024-12-22 20:03:53 +02:00
042c13b7b1
I was having issues activating the plugin, and it was because of the way the files were beeing included, this fixes it.
75 lines
2.2 KiB
PHP
75 lines
2.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* The plugin bootstrap file
|
|
*
|
|
* This file is read by WordPress to generate the plugin information in the plugin
|
|
* Dashboard. This file also includes all of the dependencies used by the plugin,
|
|
* registers the activation and deactivation functions, and defines a function
|
|
* that starts the plugin.
|
|
*
|
|
* @link http://example.com
|
|
* @since 1.0.0
|
|
* @package Plugin_Name
|
|
*
|
|
* @wordpress-plugin
|
|
* Plugin Name: WordPress Plugin Boilerplate
|
|
* Plugin URI: http://example.com/plugin-name-uri/
|
|
* Description: This is a short description of what the plugin does. It's displayed in the WordPress dashboard.
|
|
* Version: 1.0.0
|
|
* Author: Your Name or Your Company
|
|
* Author URI: http://example.com/
|
|
* License: GPL-2.0+
|
|
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
|
* Text Domain: plugin-name
|
|
* Domain Path: /languages
|
|
*/
|
|
|
|
// If this file is called directly, abort.
|
|
if ( ! defined( 'WPINC' ) ) {
|
|
die;
|
|
}
|
|
|
|
/**
|
|
* The code that runs during plugin activation.
|
|
* This action is documented in includes/class-plugin-name-activator.php
|
|
*/
|
|
function activate_plugin_name() {
|
|
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name-activator.php';
|
|
Plugin_Name_Activator::activate();
|
|
}
|
|
|
|
/**
|
|
* The code that runs during plugin deactivation.
|
|
* This action is documented in includes/class-plugin-name-deactivator.php
|
|
*/
|
|
function deactivate_plugin_name() {
|
|
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name-deactivator.php';
|
|
Plugin_Name_Deactivator::deactivate();
|
|
}
|
|
|
|
register_activation_hook( __FILE__, 'activate_plugin_name' );
|
|
register_deactivation_hook( __FILE__, 'deactivate_plugin_name' );
|
|
|
|
/**
|
|
* The core plugin class that is used to define internationalization,
|
|
* dashboard-specific hooks, and public-facing site hooks.
|
|
*/
|
|
require plugin_dir_path( __FILE__ ) . 'includes/class-plugin-name.php';
|
|
|
|
/**
|
|
* Begins execution of the plugin.
|
|
*
|
|
* Since everything within the plugin is registered via hooks,
|
|
* then kicking off the plugin from this point in the file does
|
|
* not affect the page life cycle.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
function run_plugin_name() {
|
|
|
|
$plugin = new Plugin_Name();
|
|
$plugin->run();
|
|
|
|
}
|
|
run_plugin_name();
|