gamajo / genesis-js-no-js
WordPress plugin for Genesis child themes to allow differing styles for elements if JavaScript is active or not.
Installs: 663
Dependents: 0
Suggesters: 0
Security: 0
Stars: 22
Watchers: 4
Forks: 3
Open Issues: 0
Type:wordpress-plugin
Requires
- php: ^7.0
- composer/installers: ~1.4
- roave/security-advisories: dev-master
Requires (Dev)
- php: ^7.1
- brain/monkey: ^2.1
- dealerdirect/phpcodesniffer-composer-installer: ^0.4.3
- infection/infection: 0.6.*
- object-calisthenics/phpcs-calisthenics-rules: ^3
- phpunit/phpunit: ^6.4
- squizlabs/php_codesniffer: 3.1
- wimg/php-compatibility: dev-master
- wp-coding-standards/wpcs: dev-develop
README
Make front end styling easier for child themes on the Genesis Framework based on whether JavaScript is enabled or not.
Description
If you look at the source of a WordPress back end page, you'll see it has a body class of no-js
. Immediately after the opening body
tag is a small script which replaces no-js
with js
(you can see the amended class with Firebug / Inspector).
WordPress uses this to apply different styles to the same elements, depending on whether JavaScript is present or not.
This plugin recreates the same effect, but for the front end of Genesis Framework child themes. It uses the genesis_before
hook supplied by Genesis, so it won't work for other themes.
The script is fairly small so does not block rendering of other content for any noticeable length of time.
Putting the script at the top also reduces a flash of incorrectly styled content, as the page does not load with no-js
styles, then switch to js
once everything has finished loading.
Installation
Once this plugin is installed and activated, then it will work automatically. There are no options, and nothing to set-up.
Upload
- Download the latest tagged archive (choose the "zip" option).
- Go to the Plugins -> Add New screen and click the Upload tab.
- Upload the zipped archive directly.
- Go to the Plugins screen and click Activate.
Manual
- Download the latest tagged archive (choose the "zip" option).
- Unzip the archive.
- Copy the folder to your
/wp-content/plugins/
directory. - Go to the Plugins screen and click Activate.
Check out the Codex for more information about installing plugins manually.
Git
Using git, browse to your /wp-content/plugins/
directory and clone this repository:
git clone git@github.com:GaryJones/genesis-js-no-js.git
Then go to your Plugins screen and click Activate.
Composer
composer require gamajo/genesis-js-no-js
Updates
This plugin supports the GitHub Updater plugin, so if you install that, this plugin becomes automatically updateable direct from GitHub.
Credits
Built by Gary Jones
Copyright 2011 Gamajo