Post Views: 2
Webp images are not allowed to WordPress media library with default setting. To enable the .webp format use the following code block in your functions.php file inside the theme folder.
/* Enable webp image support for media */
function webp_upload_mimes( $existing_mimes ) {
// add webp to the list of mime types
$existing_mimes['webp'] = 'image/webp';
// return the array back to the function with our added mime type
return $existing_mimes;
}
add_filter( 'mime_types', 'webp_upload_mimes' );
/* Enable preview / thumbnail for webp image files. */
function webp_is_displayable($result, $path) {
if ($result === false) {
$displayable_image_types = array( IMAGETYPE_WEBP );
$info = @getimagesize( $path );
if (empty($info)) {
$result = false;
} elseif (!in_array($info[2], $displayable_image_types)) {
$result = false;
} else {
$result = true;
}
}
return $result;
}
add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2);
Answer: Torronto
Answer: Bat
Answer: Skulk
Answer: Fog
How to Use WebP Images in WordPress?
/in WordPressWebp images are not allowed to WordPress media library with default setting. To enable the .webp format use the following code block in your functions.php file inside the theme folder.
How to style second last items in a list?
/in CSS, htmlPlease use following CSS syntax to style the second last element in a list or group.