GeneratorsCorePlugin Header

Plugin Header Generator

Fourteen header fields, a guard clause, path constants and — if you want it — a singleton bootstrap. The file every plugin starts from, written properly once.

acme-toolkit.php
Saved just now
How the Plugins screen reads
Acme ToolkitDeactivate | Settings
Editorial tools for the Acme site: briefs, review workflow and a weekly digest.
Version 1.0.0 | By GrowQuest | Requires PHP 7.4
Identity
79 characters — the Plugins screen truncates around 140.
Requirements and licence
What else goes in the file
Domain Path
Points core at /languages for your own translation files.
load_plugin_textdomain()
Loads the .mo files you ship, which core does not do for you.
Bootstrap class
A single-instance entry object with includes() and hooks().
Network only
Network: true — activatable network-wide on multisite only.
Save as acme-toolkit/acme-toolkit.php — the folder name must match the text domain.
<?php
/**
 * Plugin Name:        Acme Toolkit
 * Description:        Editorial tools for the Acme site: briefs, review workflow and a weekly digest.
 * Version:            1.0.0
 * Requires at least:  6.0
 * Tested up to:       6.8
 * Requires PHP:       7.4
 * Author:             GrowQuest
 * Author URI:         https://growquest.io
 * License:            GPL-2.0-or-later
 * License URI:        https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain:        acme-toolkit
 * Domain Path:        /languages
 * Update URI:         false
 *
 * Generated with WP CodeKit — powered by GrowQuest (https://growquest.io).
 *
 * @package Acme_Toolkit
 */

defined( 'ABSPATH' ) || exit;

// Fail loudly here rather than fatally later.
if ( version_compare( PHP_VERSION, '7.4', '<' ) ) {
	return;
}

define( 'ACME_TOOLKIT_VERSION',   '1.0.0' );
define( 'ACME_TOOLKIT_FILE',      __FILE__ );
define( 'ACME_TOOLKIT_PATH',      plugin_dir_path( __FILE__ ) );
define( 'ACME_TOOLKIT_URL',       plugin_dir_url( __FILE__ ) );
define( 'ACME_TOOLKIT_BASENAME',  plugin_basename( __FILE__ ) );

/**
 * Load translations.
 *
 * Since WordPress 4.6 core loads directory-hosted translations for you;
 * this is for the ones you ship yourself.
 */
function acme_toolkit_load_textdomain() {
	load_plugin_textdomain( 'acme-toolkit', false, dirname( ACME_TOOLKIT_BASENAME ) . '/languages' );
}
add_action( 'init', 'acme_toolkit_load_textdomain' );

/**
 * The plugin, as one object.
 */
final class Acme_Toolkit {

	/**
	 * The single instance.
	 *
	 * @var Acme_Toolkit|null
	 */
	private static $instance = null;

	/**
	 * Get the instance, creating it on first call.
	 *
	 * @return Acme_Toolkit
	 */
	public static function instance() {
		if ( null === self::$instance ) {
			self::$instance = new self();
			self::$instance->boot();
		}

		return self::$instance;
	}

	/**
	 * Load the pieces and wire the hooks.
	 */
	private function boot() {
		$this->includes();
		$this->hooks();
	}

	/**
	 * Require the plugin’s own files.
	 */
	private function includes() {
		require_once ACME_TOOLKIT_PATH . 'includes/class-settings.php';
		require_once ACME_TOOLKIT_PATH . 'includes/class-assets.php';
	}

	/**
	 * Everything this plugin hooks into.
	 */
	private function hooks() {
		add_action( 'init', array( $this, 'register' ) );
	}

	/**
	 * Registration that belongs on init.
	 */
	public function register() {
		// Post types, taxonomies and shortcodes go here.
	}
}

Acme_Toolkit::instance();