← All changes
|
includes/widgets/Off_Canvas_Content/Off_Canvas_Content.php
+7
-0
51.1.78
→
51.1.87
View file →
| @@ -638,8 +638,15 @@ | ||
| 638 | 638 | |
| 639 | 639 | const offCanvas = document.querySelector('." . esc_js($class_ID) . "'); |
| 640 | 640 | const overlay = document.querySelector('." . esc_js($overlay_ID) . "'); |
| 641 | 641 | |
| 642 | + // With no template picked the widget prints a placeholder instead of | |
| 643 | + // the panel markup, so these lookups come back empty. Bail out rather | |
| 644 | + // than throwing on insertBefore and losing the handlers below. | |
| 645 | + if (!offCanvas || !overlay) { | |
| 646 | + return; | |
| 647 | + } | |
| 648 | + | |
| 642 | 649 | // Moves all off-canvases to right after the <body> opens |
| 643 | 650 | document.body.insertBefore(overlay, document.body.firstChild); |
| 644 | 651 | document.body.insertBefore(offCanvas, document.body.firstChild); |
| 645 | 652 | |