Skip to content

Instantly share code, notes, and snippets.

@raideus
Created June 11, 2012 21:48
Show Gist options
  • Save raideus/2912958 to your computer and use it in GitHub Desktop.
Save raideus/2912958 to your computer and use it in GitHub Desktop.
PHP Auto Include
<?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