WordPress plugin which contains a collection of modules to apply theme-agnostic front-end modifications

Overview

Soil

Packagist Packagist Downloads Build Status

A WordPress plugin which contains a collection of modules to apply theme-agnostic front-end modifications.

Soil is a commercial plugin available from https://roots.io/plugins/soil/. It's hosted on a public GitHub repository to allow for contributions from the community. It's also published on Packagist to allow easier installation with Composer.

Requirements

Prerequisite How to check How to install
PHP >= 5.6.x php -v php.net

Installation

You can install this plugin via the command-line or the WordPress admin panel.

via Command-line

If you're using Composer to manage WordPress, add Soil to your project's dependencies.

composer require roots/soil

Then activate the plugin via wp-cli.

wp plugin activate soil

via WordPress Admin Panel

  1. Download the latest zip of this repo.
  2. In your WordPress admin panel, navigate to Plugins->Add New
  3. Click Upload Plugin
  4. Upload the zip file that you downloaded.

Modules

  • Cleaner WordPress markup
    add_theme_support('soil', 'clean-up');

  • Disable REST API
    add_theme_support('soil', 'disable-rest-api');

  • Disable asset versioning
    add_theme_support('soil', 'disable-asset-versioning');

  • Disable trackbacks
    add_theme_support('soil', 'disable-trackbacks');

  • Google Analytics
    add_theme_support('soil', ['google-analytics' => 'UA-XXXXX-Y']);

  • Move all JS to the footer
    add_theme_support('soil', 'js-to-footer');

  • Cleaner walker for navigation menus
    add_theme_support('soil', 'nav-walker');

  • Convert search results from /?s=query to /search/query/
    add_theme_support('soil', 'nice-search');

  • Root relative URLs
    add_theme_support('soil', 'relative-urls');

And in a format you can copy & paste into your theme:

/**
 * Enable features from Soil when plugin is activated
 * @link https://roots.io/plugins/soil/
 */
add_theme_support('soil', [
    'clean-up',
    'disable-rest-api',
    'disable-asset-versioning',
    'disable-trackbacks',
    'google-analytics' => 'UA-XXXXX-Y',
    'js-to-footer',
    'nav-walker',
    'nice-search',
    'relative-urls'
]);

Module options

Soil 4 introduced support for options on some modules.

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_recent_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',
]);

Support

Use the Roots Discourse to ask questions and get support. License is required.

Contributing

Contributions are welcome from everyone. We have contributing guidelines to help you get started.

Community

Keep track of development and community news.

Comments
  • Refactored root_relative_url()

    Refactored root_relative_url()

    • Switched from $_SERVER['SERVER_NAME'] to WP_SITEURL
    • Fixed Undefined Index warning in wp-cli export
    • Fixed bug where ports aren't correctly matched
    • Added handling of scheme-less urls
    • Simplified logic
    • Improved readability by spreading long conditional across several lines
    opened by joemaller 12
  • Properly make URLs relative when using multisite with domain mapping

    Properly make URLs relative when using multisite with domain mapping

    Currently when using Soil with Sage, URLs for styles and scripts being queued through the asset pipeline use the network site url instead of a URL mapped through a domain mapping plugin. This causes the check for matching URLs to fail, and the asset URLs are not made relative.

    opened by aaronhuisinga 12
  • Don't lose additional query string arguments on redirect

    Don't lose additional query string arguments on redirect

    The nicer search module currently discards all additional query string arguments on redirect. This patch should fix that, so that links like /?s=query&post_type=cpt get changed to /search/query?post_type=cpt.

    opened by goblindegook 11
  • Update relative-urls.php

    Update relative-urls.php

    some sitemap plugin like yoast seo generate url for sitemap like : http://domain.com/post-sitemap1.xml http://domain.com/page-sitemap.xml http://domain.com/post_tag-sitemap4.xml ... and prev regex cannot handel this type of url and cause of error in google webmaster the new regex fix this problem

    opened by z-avanes 9
  • Enhancement: Add DNS Prefetch feature

    Enhancement: Add DNS Prefetch feature

    addresses #37

    DNS Prefetch for External Sources

    This enhancement adds a new Soil feature which looks at all enqueued scripts and styles, comparing them to the site url, and adds explicit DNS Prefetch Link to head if it doesn't match.

    https://github.com/h5bp/html5-boilerplate/blob/master/dist/doc/extend.md#dns-prefetching

    The only thing I was unable to achieve, according to the linked documentation from h5bp, was inserting this after charset Meta. If anyone knows of a way to achieve this I would be happy to make adjustments.

    I have not thoroughly tested this patch against a full fledged install yet, but it does work on a clean Roots install, only adding a link for the external jQuery.

    It is enabled with add_theme_support('soil-dns-prefetch-external-assets') as per the Soil pattern.

    opened by Tidal-Wave 9
  • Remove version query strings from all assets

    Remove version query strings from all assets

    PageSpeed recommends removing query strings from all static resources

    Most proxies, most notably Squid up through version 3.0, do not cache resources with a "?" in their URL. To enable proxy caching for these resources, remove query strings from references to static resources, and instead encode the parameters into the file names themselves.

    This commit make sure all assets have the ver query string stripped.

    opened by bostondv 9
  • Replaced sanitized title with post_name fixes #161

    Replaced sanitized title with post_name fixes #161

    This should resolve issue #161 as raised by @av3nger by replacing the sanitised title in menu item's CSS class name with its slug. Two potential issues I can see with this:

    1. I'm not sure why the sanitized title was used initially, but I'm sure there probably was a reason. @retlehs any ideas?
    2. Any existing theme's that update soil that currently rely on the class names of the menu items could see a (style) breaking change if this gets merged. Don't think there's anything we can do about it, just worth noting...
    opened by iamjoshellis 7
  • Fix js error, caused by replace single quotes

    Fix js error, caused by replace single quotes

    In some cases, script tags might contain js code document.write() with single quotes - like wp_get_script_polyfill. Replacing all single quotes lead to an SyntaxError. So add slashes in document.write arguments fixes this.

    opened by dsturm 5
  • Move addition/removal of filters to walk function

    Move addition/removal of filters to walk function

    Fix #212 by removing menu-related filters after the NavWalker finishes performing a 'walk'

    This allows for menus on a page to use different walkers independently.

    opened by briggySmalls 5
  • Add module for a cleaner navigation walker

    Add module for a cleaner navigation walker

    this is the same walker from the sage theme except for:

    • bootstrap-specifics have been removed
    • make the walker the default if one isn't defined (basically reverting https://github.com/roots/sage/pull/1217)
    opened by retlehs 5
  • Add RSD link

    Add RSD link

    Removing the RSD link causes the WordPress mobile app for iOS and Android to be unable to connect to self-hosted sites. Deleting the action that removes the RSD link fixes the connect issue.

    opened by bostondv 5
  • Patch for NavWalker issue with WP Customizer.

    Patch for NavWalker issue with WP Customizer.

    All navigation elements displayed using wp_nav_menu should be automatically available for customization via selective refresh (https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/).

    Additionally, an edit icon should appear near any of these navigations (screen):

    screenshot 2019-02-07 at 08 28 27

    After enabling Soil, above functionality breaks and edit icon is not applied anymore (screen):

    screenshot 2019-02-07 at 08 30 25

    It's because nav walkers should be added as class names strings instead of object instances.

    Source: https://wordpress.stackexchange.com/questions/281854/visible-edit-shortcut-for-wordpress-menu-that-uses-nav-walker https://make.wordpress.org/core/2015/07/29/fast-previewing-changes-to-menus-in-the-customizer/

    Unfortunately because of WordPress core bug, if you try to add a class name into nav menu walkers it breaks with Using $this when not in object context.

    Apparently, there is some confusion in track ticket: https://core.trac.wordpress.org/ticket/14142

    This patch uses a workaround proposed here: https://wordpress.stackexchange.com/a/295475

    After which customizer nav menus quick edit icon is back (screen):

    screenshot 2019-02-07 at 08 31 01 module/nav-walker 
    opened by dawidurbanski 0
Releases(4.1.1)
Owner
Roots
Tools for modern WordPress development
Roots
Tcc realizado na Etec de Guaianazes (2021),onde eu fui o back-end e Vinicius de Almeida foi o front-end.

TCC-Facilita+ Todos os arquivos do projeto de TCC (Facilita+) da Etec de Guaianases realizado em 2021 1° Para utilizar os arquivos,primeiro será nesce

Helder Davidson Rodrigues Alvarenga 0 Jun 15, 2022
A research raw data repository for researchers of Arba Minch University built using Codeigniter which follows MVC architecture. The front-end is build using Bootstrap.

Arba Minch University Dataset Repository This system is a research dataset repository for Arba Minch University researchers and is build using Codeign

Wuletaw Wonte 8 Jul 1, 2022
Contains a few tools usefull for making your test-expectations agnostic to operating system specifics

PHPUnit Tools to ease cross operating system Testing make assertEquals* comparisons end-of-line (aka PHP_EOL) character agnostic Make use of EolAgnost

Markus Staab 1 Jan 3, 2022
MagentoSnippets - Magento Front End Snippets, plugin for Sublime Text

MagentoSnippets Magento Front End Snippets, plugin for Sublime Text. This tool serves to aid the productivity during the Magento's theme development t

MageFront 27 Nov 1, 2022
Friendly open source CMS forged on Codeigniter 3. FI v1.x uses the old lite theme and all modules.

ForgeIgniter v1.x - CI-3.x Friendly open source CMS forged on Codeigniter 3 This version is now discontinued, please check version 2 or 3 for updates.

ForgeIgniter 1 Jan 28, 2022
Plugin for composer to apply patches onto dependencies.

composer-patches-plugin This plugin allows you to provide patches for any package from any package. If you don't want a patch package outside the root

Netresearch 75 Aug 7, 2022
Nuber is an open source container management platform it provides a front end to manage your own cloud infrastructure, using Linux Containers virtualization technology

Nuber is an open source container management platform it provides a front end to manage your own cloud infrastructure, using Linux Containers virtualization technology

null 33 Dec 14, 2022
A next-generation package manager for the front-end

Duo is a next-generation package manager that blends the best ideas from Component, Browserify and Go to make organizing and writing front-end code qu

Duo 3.4k Dec 28, 2022
Phalcon Mooc an example API + Front End with automated tests

NovaMooc - a Phalcon project A Mooc project developed with Phalcon, a PHP framework. Key Features • How To Use • Contributing • Credits • License Key

Les Enovateurs 19 Dec 4, 2022
Resources for the Magento 2 Certified Professional Front End Developer exam

Magento 2 Certified Professional Front End Developer Training Resources Below are the 6 slide decks used internally at Fisheye to help us prepare for

Fisheye Academy 109 Oct 21, 2022
Next-generation front-end for Magento 2

The next-generation front-end for Magento 2. Fast. Reliable. Extensible. Getting started – create a new application and deploy it as Magento 2 theme o

ScandiPWA 509 Jan 2, 2023
Set of front-end tools for Magento 2 based on Gulp.js

Magento 2 Frontools Set of front-end tools for Magento 2 Requirements Unix-like OS (please, do not ask about Windows support) Node.js LTS version. We

SNOW.DOG 433 Dec 6, 2022
Simply removes the applcation's front-end and redirects it to the admin area.

Simply removes the application's front-end and redirects it to the admin area.

Albright Labs 1 Mar 28, 2022
Starless Sky is a network protocol for secure identities, providing the use of assymetric identities, public information, end-to-end messaging and smart contracts

Descentralized network protocol providing smart identity over an secure layer. What is the Starless Sky Protocol? Starless Sky is a network protocol f

Starless Sky Protocol 3 Jun 19, 2022
This Repository contains a custom Workflow for Alfred which provides the function to instantly search in the Magento 2 DevDocs

Introduction Add the custom search to your Alfred Workflow and have a quicker access to the Magento 2 DevDocs. Installation Just download the alfredwo

David Lambauer 10 Jun 29, 2022
Learn to apply best practices as a PHP backend developer

PHP eCommerce Project Here are the things that this repo will cover: Object oriented programming principles and best practices Object oriented session

Muhammad Salah 0 Aug 2, 2022
A collection of useful codes and utilities for WordPress plugin development..

WordPress Utils A collection of useful codes and utilities for WordPress plugin development. These simplifies common tasks and promote code reusabilit

weDevs 5 Jun 9, 2023
This repository contains the codebase PHP bridge using RoadRunner Jobs plugin.

RoadRunner Jobs Plugin This repository contains the codebase PHP bridge using RoadRunner Jobs plugin. Installation To install application server and J

Spiral Scout 15 Nov 9, 2022
This library provides a collection of native enum utilities (traits) which you almost always need in every PHP project.

This library provides a collection of native enum utilities (traits) which you almost always need in every PHP project.

DIVE 20 Nov 11, 2022