Skip to content

Commit

Permalink
Move main plugin function into its own file
Browse files Browse the repository at this point in the history
  • Loading branch information
dlh01 committed May 30, 2024
1 parent c69cfc8 commit 6feb0ca
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
13 changes: 3 additions & 10 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

namespace Create_WordPress_Plugin;

use Alley\WP\Features\Group;

if ( ! defined( 'ABSPATH' ) ) {
exit;
}
Expand Down Expand Up @@ -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();
2 changes: 0 additions & 2 deletions src/assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,3 @@ function load_scripts(): void {
}
}
}

load_scripts();
21 changes: 21 additions & 0 deletions src/main.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* The main plugin function
*
* @package create-wordpress-plugin
*/

namespace Create_WordPress_Plugin;

use Alley\WP\Features\Group;

/**
* Instantiate the plugin.
*/
function main(): void {
// Add features here.
$plugin = new Group();

$plugin->boot();
}

3 changes: 0 additions & 3 deletions src/meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit 6feb0ca

Please sign in to comment.