Skip to content

Commit

Permalink
fix tiktok support
Browse files Browse the repository at this point in the history
  • Loading branch information
mogmarsh committed Mar 28, 2024
1 parent 30fb062 commit 385ba6d
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 129 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to `WP Block Converter` will be documented in this file.
## 1.3.2

- Preserve new lines in embed blocks. They are required for proper front end rendering.
- Fix aspect ratio calculation when height and width are percentages - which fixes TikTok embeds.

## 1.3.1

Expand Down
2 changes: 1 addition & 1 deletion src/class-block-converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ protected function embed( string $url ): Block {
$data = _wp_oembed_get_object()->get_data( $url, [] );

$aspect_ratio = '';
if ( ! empty( $data->height ) && ! empty( $data->width ) ) {
if ( ! empty( $data->height ) && ! empty( $data->width ) && is_numeric( $data->height ) && is_numeric( $data->width ) ) {
if ( 1.78 === round( $data->width / $data->height, 2 ) ) {
$aspect_ratio = '16-9';
}
Expand Down
Loading

0 comments on commit 385ba6d

Please sign in to comment.