From c804143db67911dcf6361a626c38d8ada2e1b623 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 29 Jun 2021 12:57:56 +0000 Subject: [PATCH] Twenty Seventeen: Avoid JS errors when displaying legacy widgets. Make sure the `$sidebar` variable is defined and has at least one entry in the array, before adding the `.below-entry-meta` class to elements below the entry meta. Previously, the theme expected sidebar markup to exist on the page if sidebars are defined, but that markup is missing since only the widget itself and headers/footers of the page are loaded in the iframe used to display legacy widgets (widgets added prior to WordPress 5.8). Props Clorith, Boniu91, desrosj. Fixes #53512. Built from https://develop.svn.wordpress.org/trunk@51257 git-svn-id: http://core.svn.wordpress.org/trunk@50866 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentyseventeen/assets/js/global.js | 4 +++- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-content/themes/twentyseventeen/assets/js/global.js b/wp-content/themes/twentyseventeen/assets/js/global.js index 9b4db2353b..966889233c 100644 --- a/wp-content/themes/twentyseventeen/assets/js/global.js +++ b/wp-content/themes/twentyseventeen/assets/js/global.js @@ -111,7 +111,9 @@ function belowEntryMetaClass( param ) { var sidebarPos, sidebarPosBottom; - if ( ! $body.hasClass( 'has-sidebar' ) || ( + if ( ! $body.hasClass( 'has-sidebar' ) || + typeof $sidebar === 'undefined' || + $sidebar.length < 1 || ( $body.hasClass( 'search' ) || $body.hasClass( 'single-attachment' ) || $body.hasClass( 'error404' ) || diff --git a/wp-includes/version.php b/wp-includes/version.php index 4a0a89254b..6ea8602c0c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-beta4-51256'; +$wp_version = '5.8-beta4-51257'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.