Skip to content

Instantly share code, notes, and snippets.

@nicolabavaro
Created July 14, 2015 09:39
Show Gist options
  • Save nicolabavaro/34e978442c539417df0f to your computer and use it in GitHub Desktop.
Save nicolabavaro/34e978442c539417df0f to your computer and use it in GitHub Desktop.
Auto Includer PHP
<?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;
}
}
?>
@nicolabavaro
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment