themes

Include Required Theme Files in WordPress

This code organizes your WordPress theme by loading all required PHP files using the require statement. It includes core theme files such as the custom header, template tags, template functions, customizer, and Jetpack compatibility, along with custom modules for enqueueing scripts and styles, general helper functions, custom image sizes, custom post types, and theme setup. Splitting functionality into separate files keeps your codebase clean, modular, and easier to maintain.

<?php

/**
 * Implement the Custom Header feature.
 */
require get_template_directory() . '/inc/custom-header.php';

/**
 * Custom template tags for this theme.
 */
require get_template_directory() . '/inc/template-tags.php';

/**
 * Functions which enhance the theme by hooking into WordPress.
 */
require get_template_directory() . '/inc/template-functions.php';

/**
 * Customizer additions.
 */
require get_template_directory() . '/inc/customizer.php';

/**
 * Load Jetpack compatibility file.
 */
if ( defined( 'JETPACK__VERSION' ) ) {
	require get_template_directory() . '/inc/jetpack.php';
}

require get_template_directory().'/include/enqueue_scripts.php';
require get_template_directory().'/include/general_function.php';
require get_template_directory().'/include/custom_image_size.php'; 
require get_template_directory().'/include/custom_post.php';
require get_template_directory().'/include/themesetup.php';

Leave a reply

Your email address will not be published. Required fields are marked *