Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move main plugin function into its own file #360

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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