Child Themes

Our development efforts are focused on supporting and advancing the Illinois WordPress Theme. While it is technically possible, we do not recommend developing child themes of the Illinois Theme. If you choose to create a child theme, please recognize you assume the maintenance burden. If your child theme breaks after the parent theme updates, you get to keep both halves.

The load order of CSS resources changes when a child theme is in use. The script below, sourced from the campus community, may assist in correcting the CSS load order.

// Include this script in your child theme's functions.php to properly enqueue a child stylesheet

function enqueue_child_styles() {

    // Create cache-busting file strings
    $bootstrap_ver = date(
        "ymd-Gis",
        filemtime( get_template_directory() . '/css/bootstrap.min.css' )
    );

    $main_css_ver = date(
        "ymd-Gis",
        filemtime( get_template_directory() . '/style.css' )
    );

    // Child Theme stylesheet (This assumes your childe stylesheet is named style.css )
    $child_css_ver = date(
        "ymd-Gis",
        filemtime( get_stylesheet_directory() . '/style.css' )
    );

    // Dequeue and deregister parent styles
    wp_dequeue_style( 'bootstrapcss' );
    wp_deregister_style( 'bootstrapcss' );

    wp_dequeue_style( 'main-css' );
    wp_deregister_style( 'main-css' );


    // Re-enqueue parent styles
    wp_enqueue_style(
        'bootstrapcss',
        get_template_directory_uri() . '/css/bootstrap.min.css',
        array(),
        $bootstrap_ver
    );
	
    wp_enqueue_style(
        'main-css',
        get_template_directory_uri() . '/style.css',
        array( 'bootstrapcss' ),
        $main_css_ver
    );

    // Enqueue the child stylesheet (This assumes your child stylesheet is named style.css )
    wp_enqueue_style(
        'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( 'bootstrapcss', 'main-css' ),
        $child_css_ver
    );
}

add_action( 'wp_enqueue_scripts', 'enqueue_child_styles', 30 );

// Ensure proper loading of the parent ACF fields
function parent_theme_field_groups($paths) {
    $path = get_template_directory().'/acf-json';
    $paths[] = $path;
    return $paths;
}

add_filter('acf/settings/load_json', 'parent_theme_field_groups');

Illinois Theme for WordPress
Email: wigg-steering-group@office365.illinois.edu
Contact us / Feedback form