Created
August 8, 2024 10:50
-
-
Save KratosGemini/b7bffce185e705ce88c7fb3bbc2779b3 to your computer and use it in GitHub Desktop.
Splitting WordPress custom code into multiple files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* General theme loading and functions | |
* | |
* @package [THEME NAME] | |
*/ | |
declare(strict_types=1); | |
namespace [SPECIFIC PREFIX]\Theme; | |
// Exit if accessed directly. | |
if ( ! defined( 'ABSPATH' ) ) { | |
http_response_code( 403 ); | |
exit; | |
} | |
require_once 'includes/dom/functions.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* DOM code loading and general functions | |
* | |
* @package [THEME NAME] | |
*/ | |
declare(strict_types=1); | |
namespace [SPECIFIC PREFIX]\Theme\DOM; | |
// Exit if accessed directly. | |
if ( ! defined( 'ABSPATH' ) ) { | |
http_response_code( 403 ); | |
exit; | |
} | |
require_once 'styles-and-scripts.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Code for enqueuing or dequeuing styles and scripts | |
* | |
* @package [THEME NAME] | |
*/ | |
declare(strict_types=1); | |
namespace [SPECIFIC PREFIX]\Theme\DOM; | |
// Exit if accessed directly. | |
if ( ! defined( 'ABSPATH' ) ) { | |
http_response_code( 403 ); | |
exit; | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment