Skip to content

Commit

Permalink
Merge pull request #360 from alleyinteractive/feature/main-file
Browse files Browse the repository at this point in the history
Move main plugin function into its own file
  • Loading branch information
dlh01 authored May 31, 2024
2 parents c69cfc8 + 036f67a commit f1acecb
Show file tree
Hide file tree
Showing 4 changed files with 23 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();
20 changes: 20 additions & 0 deletions src/main.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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 f1acecb

Please sign in to comment.