Clean up WordPress markup, use relative URLs, nicer search URLs, and disable trackbacks
If you're using Composer to manage WordPress, add Soil to your project's dependencies. Run:
composer require roots/soil 3.1.0Or manually add it to your composer.json:
"require": {
"php": ">=5.3.0",
"wordpress": "4.1.1",
"roots/soil": "3.1.0"
}Enable Soil's clean-up with:
add_theme_support('soil-clean-up');wp_head()clean up- Remove WP version from RSS feeds
- Clean up
<html>attributes - Clean up
<link>and<script>tags - Clean up
body_class() - Wrap embedded media as suggested by Readability
- Remove unnecessary dashboard widgets
- Remove unnecessary self-closing tags
Enable Soil's root relative URLs with:
add_theme_support('soil-relative-urls');Enable Soil's nice search (/search/query/) with:
add_theme_support('soil-nice-search');Enable HTML5 Boilerplate's Google Analytics snippet
add_theme_support('soil-google-analytics');
define('GOOGLE_ANALYTICS_ID', 'UA-XXXXXX');By default, the GA snippet will only be shown for non-administrators. Administrators will get a dummy ga() function that writes its arguments to the console log for testing and development purposes. If you define WP_ENV, then non-production environments will always get dummy ga() function. You can override this via the soil/displayGA filter.
add_filter('soil/displayGA', '__return_true'); // Appends H5BP's GA snippet
add_filter('soil/displayGA', '__return_false'); // Appends a dummy `ga()` function that writes arguments to console logMove all scripts to wp_footer action hook with:
add_theme_support('soil-js-to-footer');Remove trackback/pingback functionality with:
add_theme_support('soil-disable-trackbacks');Disable ver query string from all styles and scripts with:
add_theme_support('soil-disable-asset-versioning');Use the Roots Discourse to ask questions and get support.