Skip to content

Commit

Permalink
new plugin: YouTube Preview Image Resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
glueckpress committed Jan 31, 2018
1 parent 281a564 commit aa21db4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
17 changes: 17 additions & 0 deletions wp-rocket-lazyload-youtube-preview-image/README.md
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
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 not shown.

0 comments on commit aa21db4

Please sign in to comment.