Refactor functions.php

This commit is contained in:
Gary Kealy 2018-09-12 12:27:29 +01:00
parent b41d693d93
commit 9dacaa8cf5
1 changed files with 23 additions and 68 deletions

View File

@ -9,72 +9,27 @@ if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Initialize theme default settings
*/
require get_template_directory() . '/inc/theme-settings.php';
$understrap_includes = array(
'/theme-settings.php', // Initialize theme default settings.
'/setup.php', // Theme setup and custom theme supports.
'/widgets.php', // Register widget area.
'/enqueue.php', // Enqueue scripts and styles.
'/template-tags.php', // Custom template tags for this theme.
'/pagination.php', // Custom pagination for this theme.
'/hooks.php', // Custom hooks.
'/extras.php', // Custom functions that act independently of the theme templates.
'/customizer.php', // Customizer additions.
'/custom-comments.php', // Custom Comments file.
'/jetpack.php', // Load Jetpack compatibility file.
'/class-wp-bootstrap-navwalker.php', // Load custom WordPress nav walker.
'/woocommerce.php', // Load WooCommerce functions.
'/editor.php', // Load Editor functions.
);
/**
* Theme setup and custom theme supports.
*/
require get_template_directory() . '/inc/setup.php';
/**
* Register widget area.
*/
require get_template_directory() . '/inc/widgets.php';
/**
* Enqueue scripts and styles.
*/
require get_template_directory() . '/inc/enqueue.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom pagination for this theme.
*/
require get_template_directory() . '/inc/pagination.php';
/**
* Custom hooks.
*/
require get_template_directory() . '/inc/hooks.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Custom Comments file.
*/
require get_template_directory() . '/inc/custom-comments.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* Load custom WordPress nav walker.
*/
require get_template_directory() . '/inc/class-wp-bootstrap-navwalker.php';
/**
* Load WooCommerce functions.
*/
require get_template_directory() . '/inc/woocommerce.php';
/**
* Load Editor functions.
*/
require get_template_directory() . '/inc/editor.php';
foreach ( $understrap_includes as $file ) {
$filepath = locate_template( '/inc' . $file );
if ( ! $filepath ) {
trigger_error( sprintf( 'Error locating /inc%s for inclusion', $file ), E_USER_ERROR );
}
require_once $filepath;
}