Created
July 14, 2015 09:39
-
-
Save nicolabavaro/34e978442c539417df0f to your computer and use it in GitHub Desktop.
Auto Includer 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 | |
/* -------------------------------------------------------------------- | |
:: Auto-Includer | |
Loads PHP files from the /includes/ directory. For WordPress sites, | |
this code would go in your functions.php file. | |
-------------------------------------------------------------------- */ | |
foreach (glob(__DIR__ . '/includes/*.php') as $my_theme_filename) { | |
// Exclude files whose names contain -sample | |
if (!strpos($my_theme_filename, '-sample') ) { | |
include_once $my_theme_filename; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://seanbutze.com/how-to-auto-include-theme-files-with-php/