GitXplorerGitXplorer
s

starter-plugin

public
66 stars
3 forks
6 issues

Commits

List of commits on branch master.
Verified
2c18e7dd1645005ff46fcd558eeae70bb6fb272d

Move procedural code into a class (#19)

sszepeviktor committed a month ago
Verified
ba07b1d7b6740c45bd56883b49b5538b00db191b

Update integrate.yaml (#18)

sszepeviktor committed a month ago
Unverified
f7f58cd0cd898ec84b9423fb5f6519d761153f3b

Fix CS

sszepeviktor committed 9 months ago
Verified
aceef10c5f4631d8863fc43c9ae1ad2bde4d7fcf

Upgrade phpcs ruleset

sszepeviktor committed 9 months ago
Verified
8412992dde422bec61e7f502ac5f9f833c9144be

Miracle

sszepeviktor committed 9 months ago
Verified
0a07020fea944fc92f75ec858c2a70abe07d13de

Add WP 6.5 Requires Plugins header

sszepeviktor committed 9 months ago

README

The README file for this repository.

Ultimate WordPress Plugin Main File

How to leave legacy technologies behind

Source code in plugin-name.php needs PHP 7 which is present on more than 90% of WordPress installations.

Support my work

Please consider sponsoring me monthly if you use my packages in an agency.

Sponsor

Parts of plugin main file

  • Header comment
  • PHP strict types
  • PHP namespaces
  • Prevent direct execution
  • Load autoloader
  • Prevent double activation
  • Define constant values in an immutable container
  • Load translations
  • Check requirements
    • PHP and WordPress minimum version
    • Multisite installation
    • Other plugins
    • Current theme
    • Composer packages
  • Hook plugin activation functions
  • Support WP-CLI
  • Display admin notice and deactivate plugin on error

💡 Anything else goes into a separate file.

What to avoid

  • ❌ Global constants
  • ❌ Global functions
  • ❌ Classes without namespace
  • ❌ Loading PHP files with require
  • ❌ Code with side-effects outside the main file
  • ❌ Immediate execution without add_action in the main file
  • ❌ Conditional function or class definitions

Required PHP Version Required WP Version

Installation

  1. Get the plugin ZIP from ...
  2. Upload to Plugins / Add new / Upload /wp-admin/plugin-install.php?tab=upload

Usage

  1. Adjust settings ...
  2. Or add a hook add_filter('project/enable', '__return_true'); to functions.php