Last active
April 16, 2021 18:51
-
-
Save barrd/ddad60f77b3a3b2224b6f2a9900875e7 to your computer and use it in GitHub Desktop.
WordPress load all required theme dependencies using RecursiveDirectoryIterator from inc
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 | |
/** | |
* Required Dependencies | |
*/ | |
// Construct the iterator. | |
$rdi = new RecursiveDirectoryIterator( get_template_directory() . '/inc' ); | |
// Loop through PHP files. | |
foreach ( new RecursiveIteratorIterator( $rdi ) as $file ) { | |
if ( $file->getExtension() === 'php' ) { | |
require $file; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment