Created
August 15, 2019 14:36
-
-
Save adam-laita/3f2fa9c773122c63e4de71a92e2196c2 to your computer and use it in GitHub Desktop.
WordPress - Auto Cloudinary - Defaults (plugin)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: Auto Cloudinary - Defaults | |
| Plugin URI: https://gist.github.com/TheALuminium/3f2fa9c773122c63e4de71a92e2196c2 | |
| Description: A simple add-on that sets the recommended compression values and format for the Auto Cloudinary plugin. | |
| Version: 1.0 | |
| Author: Adam Laita | |
| Author URI: https://www.laita.cz/en | |
| License: GPL2 | |
| */ | |
| function laita_auto_cloudinary_defaults() { | |
| // checks if the Auto Cloudinary plugin exists | |
| if ( function_exists( 'cloudinary_url' ) ) { | |
| // adds specific parameters for cloudinary URLs | |
| add_filter( 'cloudinary_default_args', function( $args ) { | |
| $args['transform']['quality'] = 'auto:eco'; | |
| $args['transform']['fetch_format'] = 'auto'; | |
| return $args; | |
| } ); | |
| } | |
| } | |
| add_action( 'plugins_loaded', 'laita_auto_cloudinary_defaults' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment