Theme support for Soil 3.x and 4.x?

Soil 4.x uses a new theme support key and options array.
Should a theme that supported Soil 3.x (as Sage 9.x) should replace the legacy theme supports or also append the new ones for Soil 4.x?
How hard is it to update from previous Soil to recent Soil? The soil licenses are valid for all current and future releases of Soil?

Soil 3 to 4 upgrade path

Existing versions of Soil work by enabling features as such:

add_theme_support('soil-clean-up');
add_theme_support('soil-nav-walker');
add_theme_support('soil-nice-search');
add_theme_support('soil-relative-urls');

This has been changed to support two different ways of enabling Soil features. The first one is a similar approach:

add_theme_support('soil', 'clean-up');
add_theme_support('soil', 'nav-walker');
add_theme_support('soil', 'nice-search');
add_theme_support('soil', 'relative-urls');

Alternatively, you can setup all modules at once, along with defining options for some:

add_action('after_setup_theme', function() {
    add_theme_support('soil', [
        'clean-up',
        'disable-rest-api',
        'disable-asset-versioning',
        'disable-trackbacks',
        'google-analytics' => [
            'should_load' => true,
            'google_analytics_id' => 'UA-XXXYYY',
            'anonymize_ip' => true,
        ],
        'js-to-footer',
        'nav-walker',
        'nice-search',
        'relative-urls'
    ]);
});

Yes :+1:

1 Like

Concerning the Sage 9.x update branch: Should the theme supports added for Soil 3.x and Soil 4.x?
Or just Soil 4.x as updating to latest Soil is always relatively trivial and free?

I’d say use the Soil 4 syntax :+1:

1 Like

Changed in the Sage 9.1 update branch.