diff --git a/includes/class-convertkit.php b/includes/class-convertkit.php index 6589e31f6..f1657fc11 100644 --- a/includes/class-convertkit.php +++ b/includes/class-convertkit.php @@ -242,16 +242,29 @@ public static function page_takeover() { if ( isset( $queried_object->post_type ) && 'page' === $queried_object->post_type ) { - $landing_page_url = self::_get_meta( $queried_object->ID, 'landing_page' ); - - $landing_page = self::$api->get_resource( $landing_page_url ); - - if ( ! empty( $landing_page ) ) { - $script = WP_ConvertKit::get_ck_script(); - $script .= "\n"; - $landing_page = str_replace( '', $script, $landing_page ); - echo $landing_page; // WPCS: XSS ok. - exit; + $landing_page_id = self::_get_meta( $queried_object->ID, 'landing_page' ); + + if ( strstr( $landing_page_id, 'http') ) { + // Old landing page + $landing_page = self::$api->get_resource( $landing_page_id ); + if ( ! empty( $landing_page ) ) { + $script = WP_ConvertKit::get_ck_script(); + $script .= ""; + $landing_page = str_replace( '', $script, $landing_page ); + echo $landing_page; // WPCS: XSS ok. + exit; + } + } else { + // New landing page + $landing_pages = get_option( 'convertkit_landing_pages' ); + $landing_page = self::$api->get_resource( $landing_pages[$landing_page_id]['embed_url'] ); + if ( ! empty( $landing_page ) ) { + $script = WP_ConvertKit::get_ck_script( true ); + $script .= ""; + $landing_page = str_replace( '', $script, $landing_page ); + echo $landing_page; // WPCS: XSS ok. + exit; + } } } } @@ -263,9 +276,16 @@ public static function page_takeover() { * javascript if we want subscribers tagged correctly. * * @since 1.5.2 + * @param bool $include_jquery + * @return string */ - public static function get_ck_script() { - $script = ""; + public static function get_ck_script( $include_jquery = false) { + $script = ''; + if ( $include_jquery ) { + $scripts = new WP_Scripts(); + $script .= ""; + } + $script .= ""; $script .= ""; $script .= "'; return $script; @@ -576,7 +596,7 @@ public static function upgrade() { ConvertKit_Custom_Content::create_table(); update_option( 'convertkit_version', CONVERTKIT_PLUGIN_VERSION ); - } elseif ( version_compare( $current_version, '1.6.0', '<' ) ) { + } elseif ( version_compare( $current_version, '1.6.1', '<' ) ) { // Refresh the forms meta to get new forms builder settings $api_key = self::_get_settings( 'api_key' ); if ( ! empty( $api_key ) ) { diff --git a/readme.txt b/readme.txt index 52b3157eb..3bc782e04 100755 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://convertkit.com Tags: email, marketing, embed form, convertkit, capture Requires at least: 3.6 Tested up to: 4.9.6 -Stable tag: 1.6.0 +Stable tag: 1.6.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -46,6 +46,11 @@ Yes, for it to work you must first have an account on ConvertKit.com == Changelog == +### 1.6.1 2018-07-03 +* Fix for landing pages not showing in the admin area drop down +* Fix for showing new landing pages on the front end of the site +* Added jquery to landing pages as new landing page builder does not include it + ### 1.6.0 2018-06-30 * Add support for new form builder * Remove unnecessary API calls diff --git a/views/backend/meta-boxes/meta-box.php b/views/backend/meta-boxes/meta-box.php index d0c0a1d89..00dad88df 100644 --- a/views/backend/meta-boxes/meta-box.php +++ b/views/backend/meta-boxes/meta-box.php @@ -39,10 +39,14 @@

diff --git a/wp-convertkit.php b/wp-convertkit.php index f3b52e94b..b9914a7e5 100644 --- a/wp-convertkit.php +++ b/wp-convertkit.php @@ -3,7 +3,7 @@ * Plugin Name: ConvertKit * Plugin URI: https://convertkit.com/ * Description: Quickly and easily integrate ConvertKit forms into your site. - * Version: 1.6.0 + * Version: 1.6.1 * Author: ConvertKit * Author URI: https://convertkit.com/ * Text Domain: convertkit @@ -16,7 +16,7 @@ define( 'CONVERTKIT_PLUGIN_FILE', plugin_basename( __FILE__ ) ); define( 'CONVERTKIT_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'CONVERTKIT_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); -define( 'CONVERTKIT_PLUGIN_VERSION', '1.6.0' ); +define( 'CONVERTKIT_PLUGIN_VERSION', '1.6.1' ); require_once CONVERTKIT_PLUGIN_PATH . '/includes/class-convertkit.php'; require_once CONVERTKIT_PLUGIN_PATH . '/includes/class-convertkit-api.php';