From 6feb0ca701f3cb8516ea3df2bcf90e624266000a Mon Sep 17 00:00:00 2001 From: David Herrera Date: Wed, 29 May 2024 23:56:35 -0400 Subject: [PATCH 1/2] Move main plugin function into its own file --- plugin.php | 13 +++---------- src/assets.php | 2 -- src/main.php | 21 +++++++++++++++++++++ src/meta.php | 3 --- 4 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 src/main.php diff --git a/plugin.php b/plugin.php index 6c1f73b1..0772e4f0 100644 --- a/plugin.php +++ b/plugin.php @@ -17,8 +17,6 @@ namespace Create_WordPress_Plugin; -use Alley\WP\Features\Group; - if ( ! defined( 'ABSPATH' ) ) { exit; } @@ -60,13 +58,8 @@ function () { // Load the plugin's main files. require_once __DIR__ . '/src/assets.php'; require_once __DIR__ . '/src/meta.php'; +require_once __DIR__ . '/src/main.php'; -/** - * Instantiate the plugin. - */ -function main(): void { - // Add features here. - $plugin = new Group(); - $plugin->boot(); -} +load_scripts(); +register_post_meta_from_defs(); main(); diff --git a/src/assets.php b/src/assets.php index f544dbcb..248a573c 100644 --- a/src/assets.php +++ b/src/assets.php @@ -125,5 +125,3 @@ function load_scripts(): void { } } } - -load_scripts(); diff --git a/src/main.php b/src/main.php new file mode 100644 index 00000000..277d3624 --- /dev/null +++ b/src/main.php @@ -0,0 +1,21 @@ +boot(); +} + diff --git a/src/meta.php b/src/meta.php index a49d51a9..8eb05eb0 100644 --- a/src/meta.php +++ b/src/meta.php @@ -7,9 +7,6 @@ namespace Create_WordPress_Plugin; -// Register custom meta fields. -register_post_meta_from_defs(); - /** * Register meta for posts or terms with sensible defaults and sanitization. * From 036f67a2cb999fb5c0f048d6f0200bf80be82626 Mon Sep 17 00:00:00 2001 From: David Herrera Date: Thu, 30 May 2024 00:03:04 -0400 Subject: [PATCH 2/2] Spacin' --- src/main.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main.php b/src/main.php index 277d3624..6f2e8ebc 100644 --- a/src/main.php +++ b/src/main.php @@ -18,4 +18,3 @@ function main(): void { $plugin->boot(); } -