Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Conversation

@QWp6t
Copy link
Member

@QWp6t QWp6t commented Aug 20, 2020

Soil 4 is a refactor of the entire code base

Breaking Changes

Most significantly, add_theme_support() syntax is different now.

Example:

add_theme_support('soil', [
    'clean-up',
    'disable-rest-api',
    'disable-asset-versioning',
    'disable-trackbacks',
    'google-analytics' => [
        'should_load' => WP_ENV === 'production', // Only load on production
        'google_analytics_id' => 'UA-XXXYYY',
        'anonymize_ip' => true,
    ],
    'js-to-footer',
    'nav-walker' => false,
    'nice-search',
    'relative-urls'
]);
Full annotated list of features and options
/**
 * Enable features from Soil when plugin is activated
 * @link https://roots.io/plugins/soil/
 */
add_theme_support('soil', [
	/**
	 * Clean up WordPress
	 */
	'clean-up' => [
		/**
		 * Obscure and suppress WordPress information.
		 */
		'wp_obscurity',

		/**
		 * Disable WordPress emojis.
		 */
		'disable_emojis',

		/**
		 * Disable Gutenberg block library CSS.
		 */
		'disable_gutenberg_block_css',

		/**
		 * Disable extra RSS feeds.
		 */
		'disable_extra_rss',

		/**
		 * Disable recent comments CSS.
		 */
		'disable_rececent_comments_css',

		/**
		 * Disable gallery CSS.
		 */
		'disable_gallery_css',

		/**
		 * Clean HTML5 markup.
		 */
		'clean_html5_markup',
	],

	/**
	 * Disable WordPress REST API
	 */
	'disable-rest-api',
	
	/**
	 * Remove version query string from all styles and scripts
	 */
	'disable-asset-versioning',
	
	/**
	 * Disables trackbacks/pingbacks
	 */
	'disable-trackbacks',
	
	/**
	 * Google Analytics
	 */
	'google-analytics' => [
		/**
		 * This is to go live with GA.
		 *
		 * This should probably be false in non-production.
		 */
		'should_load' => false,

		/**
		 * Google Analytics ID
		 *
		 * This is also known as your "property ID" or "measurement ID"
		 *
		 * Format: UA-XXXXX-Y
		 */
		'google_analytics_id' => null,

		/**
		 * Optimize container ID
		 *
		 * Format: OPT-A1B2CD (previously: GTM-A1B2CD)
		 *
		 * @link https://support.google.com/optimize/answer/6262084
		 */
		'optimize_id' => null,

		/**
		 * Anonymize user IP addresses.
		 *
		 * This might be required depending on region.
		 *
		 * @link https://github.com/roots/soil/pull/206
		 */
		'anonymize_ip',
	],
	
	/**
	 * Moves all scripts to wp_footer action
	 */
	'js-to-footer',
	
	/**
	 * Cleaner walker for wp_nav_menu()
	 */
	'nav-walker',
	
	/**
	 * Redirects search results from /?s=query to /search/query/, converts %20 to +
	 *
	 * @link http://txfx.net/wordpress-plugins/nice-search/
	 */
	'nice-search',
	
	/**
	 * Convert absolute URLs to relative URLs
	 *
	 * Inspired by {@link http://www.456bereastreet.com/archive/201010/how_to_make_wordpress_urls_root_relative/}
	 */
	'relative-urls',
]);

TODO

  • Add ability to configure GA module
  • Test clean-up module
  • Test disable-rest-api module
  • Test disable-asset-versioning module
  • Test disable-trackbacks module
  • Test google-analytics module
  • Test js-to-footer module
  • Test nav-walker module
  • Test nice-search module
  • Test relative-urls module
  • Make sure unit tests can be run on older versions of PHP
  • Document changes and upgrade path

@QWp6t QWp6t marked this pull request as ready for review August 22, 2020 16:57
@QWp6t QWp6t requested a review from retlehs August 22, 2020 16:58
@retlehs retlehs merged commit 98582d6 into master Aug 30, 2020
@retlehs retlehs deleted the next branch August 30, 2020 15:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants