WordPress.org

Make WordPress Core

Changeset 51257


Ignore:
Timestamp:
06/29/2021 12:56:41 PM (3 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyseventeen/assets/js/global.js

    r50001 r51257  
    112112        var sidebarPos, sidebarPosBottom;
    113113
    114         if ( ! $body.hasClass( 'has-sidebar' ) || (
     114        if ( ! $body.hasClass( 'has-sidebar' ) ||
     115            typeof $sidebar === 'undefined' ||
     116            $sidebar.length < 1 || (
    115117            $body.hasClass( 'search' ) ||
    116118            $body.hasClass( 'single-attachment' ) ||
Note: See TracChangeset for help on using the changeset viewer.