Last active
August 21, 2018 19:41
-
-
Save ChrisHardie/3c546900783fcb8751f9633792a7f90e to your computer and use it in GitHub Desktop.
Example function to load plugins within wp-content/themes/mytheme/plugins/
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
/** | |
* Add in-theme plugins | |
*/ | |
function my_theme_plugins() { | |
$plugins_to_include = array( | |
'wordpress-fieldmanager/fieldmanager.php', | |
); | |
if ( count( $plugins_to_include ) ) { | |
$theme_plugin_dir = get_stylesheet_directory() . '/plugins/'; | |
foreach ( $plugins_to_include as $plugin ) { | |
if ( file_exists( $theme_plugin_dir . $plugin ) ) { | |
include_once( $theme_plugin_dir . $plugin ); | |
} | |
} | |
} | |
} | |
add_action( 'after_setup_theme', 'my_theme_plugins' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment