PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.3
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.3
3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 All 196 releases
← All changes | views/backend/post/meta-box.php +26 -8 3.3.33.4.3 View file →
@@ -68,17 +68,35 @@
68 68 <div class="convertkit-select2-container convertkit-select2-container-grid">
69 69 <select name="wp-convertkit[landing_page]" id="wp-convertkit-landing_page" class="convertkit-select2">
70 70 <option <?php selected( '', $convertkit_post->get_landing_page() ); ?> value="0" data-preserve-on-refresh="1"><?php esc_html_e( 'None', 'convertkit' ); ?></option>
71 71 <?php
72 - if ( $convertkit_landing_pages->exist() ) {
73 - foreach ( $convertkit_landing_pages->get() as $landing_page ) {
74 - if ( isset( $convertkit_landing_page['url'] ) ) {
72 + $non_legacy_landing_pages = $convertkit_landing_pages->get_non_legacy();
73 + if ( is_array( $non_legacy_landing_pages ) ) {
74 + foreach ( $non_legacy_landing_pages as $landing_page ) {
75 + ?>
76 + <option value="<?php echo esc_attr( $landing_page['id'] ); ?>"<?php selected( $landing_page['id'], $convertkit_post->get_landing_page() ); ?>><?php echo esc_attr( $landing_page['name'] ); ?></option>
77 + <?php
78 + }
79 + }
80 +
81 + // If the currently-saved landing page is a legacy resource, append
82 + // it here so the dropdown truthfully reflects the saved value
83 + // without offering other legacy pages as new selection choices.
84 + $current_landing_page = $convertkit_post->get_landing_page();
85 + if ( $current_landing_page && $convertkit_landing_pages->is_legacy( $current_landing_page ) ) {
86 + // data-preserve-on-refresh keeps this option in place when
87 + // the Refresh Resources button repopulates the dropdown,
88 + // so the saved legacy selection isn't silently lost.
89 + // Pre-1.9.6 storage: the saved value is the legacy URL itself.
90 + if ( is_string( $current_landing_page ) && strstr( $current_landing_page, 'http' ) ) {
91 + ?>
92 + <option value="<?php echo esc_attr( $current_landing_page ); ?>" data-preserve-on-refresh="1" selected><?php echo esc_attr( $current_landing_page ); ?></option>
93 + <?php
94 + } else {
95 + $legacy_landing_page = $convertkit_landing_pages->get_by_id( (int) $current_landing_page );
96 + if ( $legacy_landing_page ) {
75 97 ?>
76 - <option value="<?php echo esc_attr( $landing_page['url'] ); ?>"<?php selected( $landing_page['url'], $convertkit_post->get_landing_page() ); ?>><?php echo esc_attr( $landing_page['name'] ); ?></option>
77 - <?php
78 - } else {
79 - ?>
80 - <option value="<?php echo esc_attr( $landing_page['id'] ); ?>"<?php selected( $landing_page['id'], $convertkit_post->get_landing_page() ); ?>><?php echo esc_attr( $landing_page['name'] ); ?></option>
98 + <option value="<?php echo esc_attr( $legacy_landing_page['id'] ); ?>" data-preserve-on-refresh="1" selected><?php echo esc_attr( $legacy_landing_page['name'] ); ?></option>
81 99 <?php
82 100 }
83 101 }
84 102 }