← All changes
|
modules/subscriptions/subscribe-overlay/class-jetpack-subscribe-overlay.php
+11
-2
13.6.2
→
16.3-a.7
View file →
| @@ -5,8 +5,12 @@ | ||
| 5 | 5 | * @package automattic/jetpack-subscriptions |
| 6 | 6 | * @since 13.5 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 10 | + exit( 0 ); | |
| 11 | +} | |
| 12 | + | |
| 9 | 13 | /** |
| 10 | 14 | * Jetpack_Subscribe_Overlay class. |
| 11 | 15 | */ |
| 12 | 16 | class Jetpack_Subscribe_Overlay { |
| @@ -126,9 +130,9 @@ | ||
| 126 | 130 | <!-- wp:site-title {"textAlign":"center","isLink":false,"fontSize":"x-large"} /--> |
| 127 | 131 | |
| 128 | 132 | $tagline_block |
| 129 | 133 | |
| 130 | - <!-- wp:jetpack/subscriptions /--> | |
| 134 | + <!-- wp:jetpack/subscriptions {"appSource":"subscribe-overlay"} /--> | |
| 131 | 135 | |
| 132 | 136 | <!-- wp:paragraph {"align":"center","className":"jetpack-subscribe-overlay__to-content"} --> |
| 133 | 137 | <p class="has-text-align-center jetpack-subscribe-overlay__to-content"><a href="$home_url">$skip_to_content ↓</a></p> |
| 134 | 138 | <!-- /wp:paragraph --> |
| @@ -181,8 +185,13 @@ | ||
| 181 | 185 | if ( is_admin() ) { |
| 182 | 186 | return false; |
| 183 | 187 | } |
| 184 | 188 | |
| 189 | + // The overlay only appears on the blog home and front page. | |
| 190 | + if ( ! is_home() && ! is_front_page() ) { | |
| 191 | + return false; | |
| 192 | + } | |
| 193 | + | |
| 185 | 194 | // Needed because Elementor editor makes is_admin() return false |
| 186 | 195 | // See https://coreysalzano.com/wordpress/why-elementor-disobeys-is_admin/ |
| 187 | 196 | // Ignore nonce warning as just checking if is set |
| 188 | 197 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| @@ -209,9 +218,9 @@ | ||
| 209 | 218 | if ( ! class_exists( 'Jetpack_Memberships' ) || Jetpack_Memberships::is_current_user_subscribed() ) { |
| 210 | 219 | return false; |
| 211 | 220 | } |
| 212 | 221 | |
| 213 | - return is_home() || is_front_page(); | |
| 222 | + return true; | |
| 214 | 223 | } |
| 215 | 224 | } |
| 216 | 225 | |
| 217 | 226 | Jetpack_Subscribe_Overlay::init(); |