Skip to content

Instantly share code, notes, and snippets.

@decodigo
Last active December 19, 2015 19:08
Show Gist options
  • Save decodigo/6003423 to your computer and use it in GitHub Desktop.
Save decodigo/6003423 to your computer and use it in GitHub Desktop.
Loop through a widgets directory and dynamically include them.
<?php
//Loop through each file in the Widgets directory and include it.
foreach ( glob( get_template_directory_uri() . "/widgets/*.php", GLOB_NOSORT) as $filename ){
include $filename;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment