-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new plugin: YouTube Preview Image Resolution
- Loading branch information
1 parent
281a564
commit aa21db4
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# WP Rocket | YouTube Preview Image Resolution | ||
|
||
Customizes the resolution of the YouTube preview image for videos. | ||
|
||
📝 **Manual code edit required before use!** | ||
|
||
Before you activate the plugin, replace the placeholder value `hqdefault` in line 22 with the resolution keyword you would like to use. | ||
|
||
Documentation: | ||
* [Choose YouTube Preview Image Resolution](http://docs.wp-rocket.me/article/1062-choose-youtube-preview-image-resolution) | ||
|
||
To be used with: | ||
* any setup where LazyLoad and the YouTube preview image is enabled | ||
|
||
Last tested with: | ||
* WP Rocket 2.11.5 | ||
* WordPress 4.9.x |
38 changes: 38 additions & 0 deletions
38
wp-rocket-lazyload-youtube-preview-image/wp-rocket-lazyload-youtube-preview-image.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
/** | ||
* Plugin Name: WP Rocket | YouTube Preview Image Resolution | ||
* Description: Customizes the resolution of the YouTube preview image for videos. | ||
* Plugin URI: https://github.com/wp-media/wp-rocket-helpers/tree/master/wp-rocket-lazyload-youtube-preview-image/ | ||
* Author: WP Rocket Support Team | ||
* Author URI: http://wp-rocket.me/ | ||
* License: GNU General Public License v2 or later | ||
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | ||
* | ||
* Copyright SAS WP MEDIA 2018 | ||
*/ | ||
|
||
// Standard plugin security, keep this line in place. | ||
defined( 'ABSPATH' ) or die(); | ||
|
||
namespace WP_Rocket\Helpers\lazyload\youtube_preview_image; | ||
|
||
// EDIT THIS: | ||
// Possibles values: default, mqdefault, sddefault, hqdefault, maxresdefault | ||
|
||
define( 'WPROCKETHELPERS_LL_YT_PREVIEW_RESOLUTION', 'hqdefault' ); | ||
|
||
// STOP EDITING | ||
|
||
/** | ||
* Customise YouTube preview image resolution. | ||
* | ||
* @author Remy Perona | ||
* @param string $thumbnail_resolution Predefined keyword for preview image resolution, default: hqdefault | ||
* Possibles values: default, mqdefault, sddefault, hqdefault, maxresdefault | ||
* @return string Maybe modfied resolution keyword | ||
*/ | ||
function resolution( $thumbnail_resolution ) { | ||
|
||
return WPROCKETHELPERS_LL_YT_PREVIEW_RESOLUTION; | ||
} | ||
add_filter( 'rocket_youtube_thumbnail_resolution', __NAMESPACE__ . '\resolution' ); |
Binary file added
BIN
+1.73 KB
wp-rocket-lazyload-youtube-preview-image/wp-rocket-lazyload-youtube-preview-image.zip
Binary file not shown.