22 |
22 |
23 if ( ! isset( $attributes['idBase'] ) ) { |
23 if ( ! isset( $attributes['idBase'] ) ) { |
24 return ''; |
24 return ''; |
25 } |
25 } |
26 |
26 |
27 $id_base = $attributes['idBase']; |
27 $id_base = $attributes['idBase']; |
28 if ( method_exists( $wp_widget_factory, 'get_widget_key' ) && method_exists( $wp_widget_factory, 'get_widget_object' ) ) { |
28 $widget_key = $wp_widget_factory->get_widget_key( $id_base ); |
29 $widget_key = $wp_widget_factory->get_widget_key( $id_base ); |
29 $widget_object = $wp_widget_factory->get_widget_object( $id_base ); |
30 $widget_object = $wp_widget_factory->get_widget_object( $id_base ); |
|
31 } else { |
|
32 /* |
|
33 * This file is copied from the published @wordpress/widgets package when WordPress |
|
34 * Core is built. Because the package is a dependency of both WordPress Core and the |
|
35 * Gutenberg plugin where the block editor is developed, this fallback condition is |
|
36 * required until the minimum required version of WordPress for the plugin is raised |
|
37 * to 5.8. |
|
38 */ |
|
39 $widget_key = gutenberg_get_widget_key( $id_base ); |
|
40 $widget_object = gutenberg_get_widget_object( $id_base ); |
|
41 } |
|
42 |
30 |
43 if ( ! $widget_key || ! $widget_object ) { |
31 if ( ! $widget_key || ! $widget_object ) { |
44 return ''; |
32 return ''; |
45 } |
33 } |
46 |
34 |
106 /* Reset theme styles */ |
94 /* Reset theme styles */ |
107 html, body, #page, #content { |
95 html, body, #page, #content { |
108 padding: 0 !important; |
96 padding: 0 !important; |
109 margin: 0 !important; |
97 margin: 0 !important; |
110 } |
98 } |
|
99 |
|
100 /* Hide root level text nodes */ |
|
101 body { |
|
102 font-size: 0 !important; |
|
103 } |
|
104 |
|
105 /* Hide non-widget elements */ |
|
106 body *:not(#page):not(#content):not(.widget):not(.widget *) { |
|
107 display: none !important; |
|
108 font-size: 0 !important; |
|
109 height: 0 !important; |
|
110 left: -9999px !important; |
|
111 max-height: 0 !important; |
|
112 max-width: 0 !important; |
|
113 opacity: 0 !important; |
|
114 pointer-events: none !important; |
|
115 position: absolute !important; |
|
116 top: -9999px !important; |
|
117 transform: translate(-9999px, -9999px) !important; |
|
118 visibility: hidden !important; |
|
119 z-index: -999 !important; |
|
120 } |
|
121 |
|
122 /* Restore widget font-size */ |
|
123 .widget { |
|
124 font-size: var(--global--font-size-base); |
|
125 } |
111 </style> |
126 </style> |
112 </head> |
127 </head> |
113 <body <?php body_class(); ?>> |
128 <body <?php body_class(); ?>> |
114 <div id="page" class="site"> |
129 <div id="page" class="site"> |
115 <div id="content" class="site-content"> |
130 <div id="content" class="site-content"> |