Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wpscholar/wp-async-defer-scripts
A Composer library for asynchronously loading or deferring scripts in WordPress.
https://github.com/wpscholar/wp-async-defer-scripts
deferring-scripts wordpress wordpress-development wordpress-php-library
Last synced: about 1 month ago
JSON representation
A Composer library for asynchronously loading or deferring scripts in WordPress.
- Host: GitHub
- URL: https://github.com/wpscholar/wp-async-defer-scripts
- Owner: wpscholar
- Created: 2017-09-08T18:38:44.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-06T16:32:36.000Z (about 7 years ago)
- Last Synced: 2024-10-01T16:17:12.122Z (about 2 months ago)
- Topics: deferring-scripts, wordpress, wordpress-development, wordpress-php-library
- Language: PHP
- Homepage:
- Size: 1.95 KB
- Stars: 13
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WordPress Async/Defer Scripts
A Composer library for asynchronously loading or deferring scripts in WordPress.
## Requirements
- PHP 5.3+
- WordPress 4.2+## Installation
Add the module to your code base via Composer
```
composer require wpscholar/wp-async-defer-scripts
```Be sure to require the Composer autoloader in your project
```php
add_data( 'recaptcha', 'async', true );
} );
```How to defer loading of a script:
```php
add_data( 'recaptcha', 'defer', true );
} );
```## Initialization
In most cases, you can simply follow the installation instructions and things will just work. However, if you are including this library outside of a WordPress plugin or theme, you may have to manually initialize the class:
```php