Skip to content

Instantly share code, notes, and snippets.

@shrinkray
Last active January 25, 2021 19:32
Show Gist options
  • Save shrinkray/8876ed055b05c81acd4a063792d8e3c3 to your computer and use it in GitHub Desktop.
Save shrinkray/8876ed055b05c81acd4a063792d8e3c3 to your computer and use it in GitHub Desktop.
Add modular function partials to the function.php for a customized WordPress child theme
/**
* Theme Includes
*
* The $theme_includes array determines the code library included in your theme.
* Add or remove files to the array as needed. Supports child theme overrides.
* @parent shopical pro from AF Themes
*
* Please note that missing files will produce a fatal error.
*
*/
$theme_includes = [
'lib/assets.php', // Scripts and stylesheets
'lib/setup.php', // Theme setup
'lib/woocommerce.php', // WooCommerce Functions
];
foreach ($theme_includes as $file) {
if (!$filepath = locate_template($file)) {
trigger_error(sprintf(__('Error locating %s for inclusion', 'shopical-pro'), $file), E_USER_ERROR);
}
require_once $filepath;
}
unset($file, $filepath);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment