Skip to content

Instantly share code, notes, and snippets.

@szbl
Last active March 15, 2022 04:17
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save szbl/5924570 to your computer and use it in GitHub Desktop.
Save szbl/5924570 to your computer and use it in GitHub Desktop.
How I auto-include my library of "controllers" in a theme/plugin.
<?php
// include all PHP files in ./lib/ directory:
foreach ( glob( dirname( __FILE__ ) . '/lib/*.php' ) as $file )
include $file;
@talentedaamer
Copy link

talentedaamer commented Jan 19, 2017

<?php
foreach ( glob( plugin_dir_path( __FILE__ ) . 'admin/*.php' ) as $file ) {
    include_once $file;
}

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