From ac55ab2b7f4fe05cf710b935a149ea7d5fe1dc5d Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Thu, 16 Jan 2025 15:03:09 +0800 Subject: [PATCH 1/5] Group settings in UI for better UX --- ...ertkit-admin-settings-restrict-content.php | 103 ++++++++++++------ ...s-convertkit-admin-settings-broadcasts.php | 8 ++ .../class-convertkit-settings-base.php | 70 ++++++++---- .../class-convertkit-settings-general.php | 8 ++ 4 files changed, 139 insertions(+), 50 deletions(-) diff --git a/admin/class-convertkit-admin-settings-restrict-content.php b/admin/class-convertkit-admin-settings-restrict-content.php index 57f524fe..15707619 100644 --- a/admin/class-convertkit-admin-settings-restrict-content.php +++ b/admin/class-convertkit-admin-settings-restrict-content.php @@ -32,6 +32,22 @@ public function __construct() { $this->title = __( 'Member Content', 'convertkit' ); $this->tab_text = __( 'Member Content', 'convertkit' ); + // Define settings sections. + $this->settings_sections = array( + 'general' => array( + 'title' => $this->title, + 'callback' => array( $this, 'print_section_info' ), + ), + 'products' => array( + 'title' => __( 'Products', 'convertkit' ), + 'callback' => array( $this, 'print_section_info_products' ), + ), + 'tags' => array( + 'title' => __( 'Tags', 'convertkit' ), + 'callback' => array( $this, 'print_section_info_tags' ), + ), + ); + // Enqueue scripts. add_action( 'convertkit_admin_settings_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); @@ -86,12 +102,12 @@ public function register_fields() { __( 'reCAPTCHA: Site Key', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name, + $this->name . '-tags', array( 'name' => 'recaptcha_site_key', 'label_for' => 'recaptcha_site_key', 'description' => array( - __( 'Enter your Google reCAPTCHA v3 Site Key. When specified, this will be used in Member Content by Tag functionality to reduce spam signups.', 'convertkit' ), + __( 'Enter your Google reCAPTCHA v3 Site Key. When specified, this will be used to reduce spam signups.', 'convertkit' ), ), ) ); @@ -100,12 +116,12 @@ public function register_fields() { __( 'reCAPTCHA: Secret Key', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name, + $this->name . '-tags', array( 'name' => 'recaptcha_secret_key', 'label_for' => 'recaptcha_secret_key', 'description' => array( - __( 'Enter your Google reCAPTCHA v3 Secret Key. When specified, this will be used in Member Content by Tag functionality to reduce spam signups.', 'convertkit' ), + __( 'Enter your Google reCAPTCHA v3 Secret Key. When specified, this will be used to reduce spam signups.', 'convertkit' ), ), ) ); @@ -114,7 +130,7 @@ public function register_fields() { __( 'reCAPTCHA: Minimum Score', 'convertkit' ), array( $this, 'number_callback' ), $this->settings_key, - $this->name, + $this->name . '-tags', array( 'name' => 'recaptcha_minimum_score', 'label_for' => 'recaptcha_minimum_score', @@ -127,64 +143,64 @@ public function register_fields() { ) ); - // Restrict by Product. + // Restrict by Tag. add_settings_field( - 'subscribe_heading', - __( 'Product: Subscribe Heading', 'convertkit' ), + 'subscribe_heading_tag', + __( 'Subscribe Heading', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name, + $this->name . '-tags', array( - 'name' => 'subscribe_heading', - 'label_for' => 'subscribe_heading', + 'name' => 'subscribe_heading_tag', + 'label_for' => 'subscribe_heading_tag', 'description' => array( - __( 'When a Page, Post or Custom Post\'s Member Content setting is set to a Kit Product, displays text in a heading explaining why the content is only available to subscribers.', 'convertkit' ), + __( 'Displays text in a heading explaining why the content is only available to subscribers.', 'convertkit' ), ), ) ); add_settings_field( - 'subscribe_text', - __( 'Product: Subscribe Text', 'convertkit' ), + 'subscribe_text_tag', + __( 'Subscribe Text', 'convertkit' ), array( $this, 'textarea_callback' ), $this->settings_key, - $this->name, + $this->name . '-tags', array( - 'name' => 'subscribe_text', - 'label_for' => 'subscribe_text', + 'name' => 'subscribe_text_tag', + 'label_for' => 'subscribe_text_tag', 'description' => array( - __( 'When a Page, Post or Custom Post\'s Member Content setting is set to a Kit Product, displays text explaining why the content is only available to subscribers.', 'convertkit' ), + __( 'Displays text explaining why the content is only available to subscribers.', 'convertkit' ), ), ) ); - // Restrict by Tag. + // Restrict by Product. add_settings_field( - 'subscribe_heading_tag', - __( 'Tag: Subscribe Heading', 'convertkit' ), + 'subscribe_heading', + __( 'Subscribe Heading', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name, + $this->name . '-products', array( - 'name' => 'subscribe_heading_tag', - 'label_for' => 'subscribe_heading_tag', + 'name' => 'subscribe_heading', + 'label_for' => 'subscribe_heading', 'description' => array( - __( 'When a Page, Post or Custom Post\'s Member Content setting is set to a Kit Tag, displays text in a heading explaining why the content is only available to subscribers.', 'convertkit' ), + __( 'Displays text in a heading explaining why the content is only available to subscribers.', 'convertkit' ), ), ) ); add_settings_field( - 'subscribe_text_tag', - __( 'Tag: Subscribe Text', 'convertkit' ), + 'subscribe_text', + __( 'Subscribe Text', 'convertkit' ), array( $this, 'textarea_callback' ), $this->settings_key, - $this->name, + $this->name . '-products', array( - 'name' => 'subscribe_text_tag', - 'label_for' => 'subscribe_text_tag', + 'name' => 'subscribe_text', + 'label_for' => 'subscribe_text', 'description' => array( - __( 'When a Page, Post or Custom Post\'s Member Content setting is set to a Kit Tag, displays text explaining why the content is only available to subscribers.', 'convertkit' ), + __( 'Displays text explaining why the content is only available to subscribers.', 'convertkit' ), ), ) ); @@ -325,6 +341,31 @@ public function print_section_info() { } + /** + * Prints help info for the products section of the settings screen. + * + * @since 2.7.1 + */ + public function print_section_info_products() { + + ?> +

+ +

+ is_beta = true; + // Define settings sections. + $this->settings_sections = array( + 'general' => array( + 'title' => $this->title, + 'callback' => array( $this, 'print_section_info' ), + ), + ); + // Register and maybe output notices for this settings screen. if ( $this->on_settings_screen( $this->name ) ) { add_filter( 'convertkit_settings_base_register_notices', array( $this, 'register_notices' ) ); diff --git a/admin/section/class-convertkit-settings-base.php b/admin/section/class-convertkit-settings-base.php index e3adc8d0..244b2771 100644 --- a/admin/section/class-convertkit-settings-base.php +++ b/admin/section/class-convertkit-settings-base.php @@ -51,6 +51,15 @@ abstract class ConvertKit_Settings_Base { */ public $settings; + /** + * Holds the settings sections for a settings screen. + * + * @since 2.7.1 + * + * @var array + */ + public $settings_sections = array(); + /** * Holds whether this settings section is for beta functionality. * @@ -121,15 +130,24 @@ public function on_settings_screen( $tab ) { */ public function register_section() { - add_settings_section( - $this->name, - $this->title, - array( $this, 'print_section_info' ), - $this->settings_key - ); + // Register settings sections. + foreach ( $this->settings_sections as $name => $settings_section ) { + add_settings_section( + ( $name === 'general' ? $this->name : $this->name . '-' . $name ), + $settings_section['title'], + $settings_section['callback'], + $this->settings_key, + array( + 'before_section' => $this->get_render_container_start(), + 'after_section' => $this->get_render_container_end(), + ) + ); + } + // Register settings fields. $this->register_fields(); + // Register setting to store data in options table. register_setting( $this->settings_key, $this->settings_key, @@ -202,8 +220,6 @@ public function render() { */ do_action( 'convertkit_settings_base_render_before' ); - $this->render_container_start(); - do_settings_sections( $this->settings_key ); settings_fields( $this->settings_key ); @@ -212,8 +228,6 @@ public function render() { submit_button(); } - $this->render_container_end(); - /** * Performs actions after rendering of the settings form. * @@ -224,17 +238,14 @@ public function render() { } /** - * Outputs .metabox-holder and .postbox container div elements, + * Outputs opening .metabox-holder and .postbox container div elements, * used before beginning a setting screen's output. * * @since 2.0.0 */ public function render_container_start() { - ?> -
-
- get_render_container_start(); } @@ -246,10 +257,31 @@ public function render_container_start() { */ public function render_container_end() { - ?> -
-
- get_render_container_end(); + + } + + /** + * Returns opening .metabox-holder and .postbox container div elements, + * used before beginning a section of a settings screen output. + * + * @since 2.7.1 + */ + public function get_render_container_start() { + + return '
'; + + } + + /** + * Returns closing .metabox-holder and .postbox container div elements, + * used after finishing a section of a settings screen output. + * + * @since 2.7.1 + */ + public function get_render_container_end() { + + return '
'; } diff --git a/admin/section/class-convertkit-settings-general.php b/admin/section/class-convertkit-settings-general.php index fd7cb834..30b92aa5 100644 --- a/admin/section/class-convertkit-settings-general.php +++ b/admin/section/class-convertkit-settings-general.php @@ -57,6 +57,14 @@ public function __construct() { $this->title = __( 'General Settings', 'convertkit' ); $this->tab_text = __( 'General', 'convertkit' ); + // Define settings sections. + $this->settings_sections = array( + 'general' => array( + 'title' => $this->title, + 'callback' => array( $this, 'print_section_info' ), + ), + ); + // Register and maybe output notices for this settings screen. if ( $this->on_settings_screen( $this->name ) ) { add_filter( 'convertkit_settings_base_register_notices', array( $this, 'register_notices' ) ); From e3a4d2c760030b880111be57e59198d5ea048c18 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Thu, 16 Jan 2025 16:04:27 +0800 Subject: [PATCH 2/5] Coding standards --- ...ertkit-admin-settings-restrict-content.php | 10 +++--- ...s-convertkit-admin-settings-broadcasts.php | 2 +- .../class-convertkit-settings-base.php | 25 ++++++++++----- .../class-convertkit-settings-general.php | 32 +++++++++++++++---- .../class-convertkit-settings-oauth.php | 11 ------- .../class-convertkit-settings-tools.php | 9 ------ 6 files changed, 48 insertions(+), 41 deletions(-) diff --git a/admin/class-convertkit-admin-settings-restrict-content.php b/admin/class-convertkit-admin-settings-restrict-content.php index 15707619..71e29601 100644 --- a/admin/class-convertkit-admin-settings-restrict-content.php +++ b/admin/class-convertkit-admin-settings-restrict-content.php @@ -34,16 +34,16 @@ public function __construct() { // Define settings sections. $this->settings_sections = array( - 'general' => array( - 'title' => $this->title, + 'general' => array( + 'title' => $this->title, 'callback' => array( $this, 'print_section_info' ), ), 'products' => array( - 'title' => __( 'Products', 'convertkit' ), + 'title' => __( 'Products', 'convertkit' ), 'callback' => array( $this, 'print_section_info_products' ), ), - 'tags' => array( - 'title' => __( 'Tags', 'convertkit' ), + 'tags' => array( + 'title' => __( 'Tags', 'convertkit' ), 'callback' => array( $this, 'print_section_info_tags' ), ), ); diff --git a/admin/section/class-convertkit-admin-settings-broadcasts.php b/admin/section/class-convertkit-admin-settings-broadcasts.php index ee69059b..86f372f9 100644 --- a/admin/section/class-convertkit-admin-settings-broadcasts.php +++ b/admin/section/class-convertkit-admin-settings-broadcasts.php @@ -38,7 +38,7 @@ public function __construct() { // Define settings sections. $this->settings_sections = array( 'general' => array( - 'title' => $this->title, + 'title' => $this->title, 'callback' => array( $this, 'print_section_info' ), ), ); diff --git a/admin/section/class-convertkit-settings-base.php b/admin/section/class-convertkit-settings-base.php index 244b2771..f7bd25f8 100644 --- a/admin/section/class-convertkit-settings-base.php +++ b/admin/section/class-convertkit-settings-base.php @@ -53,10 +53,10 @@ abstract class ConvertKit_Settings_Base { /** * Holds the settings sections for a settings screen. - * - * @since 2.7.1 - * - * @var array + * + * @since 2.7.1 + * + * @var array */ public $settings_sections = array(); @@ -89,6 +89,14 @@ public function __construct() { $this->tab_text = $this->title; } + // Define settings sections. + $this->settings_sections = array( + 'general' => array( + 'title' => $this->title, + 'callback' => array( $this, 'print_section_info' ), + ), + ); + // Register the settings section. $this->register_section(); @@ -139,7 +147,7 @@ public function register_section() { $this->settings_key, array( 'before_section' => $this->get_render_container_start(), - 'after_section' => $this->get_render_container_end(), + 'after_section' => $this->get_render_container_end(), ) ); } @@ -159,7 +167,8 @@ public function register_section() { /** * Register fields for this section */ - abstract public function register_fields(); + public function register_fields() { + } /** * Prints help info for this section @@ -245,7 +254,7 @@ public function render() { */ public function render_container_start() { - echo $this->get_render_container_start(); + echo $this->get_render_container_start(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } @@ -257,7 +266,7 @@ public function render_container_start() { */ public function render_container_end() { - echo $this->get_render_container_end(); + echo $this->get_render_container_end(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } diff --git a/admin/section/class-convertkit-settings-general.php b/admin/section/class-convertkit-settings-general.php index 30b92aa5..9f258574 100644 --- a/admin/section/class-convertkit-settings-general.php +++ b/admin/section/class-convertkit-settings-general.php @@ -59,10 +59,14 @@ public function __construct() { // Define settings sections. $this->settings_sections = array( - 'general' => array( - 'title' => $this->title, + 'general' => array( + 'title' => $this->title, 'callback' => array( $this, 'print_section_info' ), ), + 'advanced' => array( + 'title' => __( 'Advanced', 'convertkit' ), + 'callback' => array( $this, 'print_section_info_advanced' ), + ), ); // Register and maybe output notices for this settings screen. @@ -354,12 +358,13 @@ public function register_fields() { ) ); + // Advanced. add_settings_field( 'debug', __( 'Debug', 'convertkit' ), array( $this, 'debug_callback' ), $this->settings_key, - $this->name, + $this->name . '-advanced', array( 'label_for' => 'debug', ) @@ -370,7 +375,7 @@ public function register_fields() { __( 'Disable JavaScript', 'convertkit' ), array( $this, 'no_scripts_callback' ), $this->settings_key, - $this->name, + $this->name . '-advanced', array( 'label_for' => 'no_scripts', ) @@ -381,7 +386,7 @@ public function register_fields() { __( 'Disable CSS', 'convertkit' ), array( $this, 'no_css_callback' ), $this->settings_key, - $this->name, + $this->name . '-advanced', array( 'label_for' => 'no_css', ) @@ -395,13 +400,13 @@ public function register_fields() { public function print_section_info() { ?> -

+

tags */ - esc_html__( 'The default form can be inserted into the middle of post or page content by using the %s shortcode.', 'convertkit' ), + esc_html__( 'The default form can be inserted into the middle of post or page content by using either the %s shortcode or block.', 'convertkit' ), '[convertkit]' ); ?> @@ -410,6 +415,19 @@ public function print_section_info() { } + /** + * Prints help info for the advanced section of the settings screen. + * + * @since 2.7.1 + */ + public function print_section_info_advanced() { + + ?> +

+ Date: Thu, 16 Jan 2025 16:13:25 +0800 Subject: [PATCH 3/5] Add `wrap` attribute to settings sections --- ...ertkit-admin-settings-restrict-content.php | 3 +++ ...s-convertkit-admin-settings-broadcasts.php | 1 + .../class-convertkit-settings-base.php | 24 +++++++++---------- .../class-convertkit-settings-general.php | 2 ++ 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/admin/class-convertkit-admin-settings-restrict-content.php b/admin/class-convertkit-admin-settings-restrict-content.php index 71e29601..79584ab6 100644 --- a/admin/class-convertkit-admin-settings-restrict-content.php +++ b/admin/class-convertkit-admin-settings-restrict-content.php @@ -37,14 +37,17 @@ public function __construct() { 'general' => array( 'title' => $this->title, 'callback' => array( $this, 'print_section_info' ), + 'wrap' => true, ), 'products' => array( 'title' => __( 'Products', 'convertkit' ), 'callback' => array( $this, 'print_section_info_products' ), + 'wrap' => true, ), 'tags' => array( 'title' => __( 'Tags', 'convertkit' ), 'callback' => array( $this, 'print_section_info_tags' ), + 'wrap' => true, ), ); diff --git a/admin/section/class-convertkit-admin-settings-broadcasts.php b/admin/section/class-convertkit-admin-settings-broadcasts.php index 86f372f9..c30b08bc 100644 --- a/admin/section/class-convertkit-admin-settings-broadcasts.php +++ b/admin/section/class-convertkit-admin-settings-broadcasts.php @@ -40,6 +40,7 @@ public function __construct() { 'general' => array( 'title' => $this->title, 'callback' => array( $this, 'print_section_info' ), + 'wrap' => true, ), ); diff --git a/admin/section/class-convertkit-settings-base.php b/admin/section/class-convertkit-settings-base.php index f7bd25f8..e0b994c8 100644 --- a/admin/section/class-convertkit-settings-base.php +++ b/admin/section/class-convertkit-settings-base.php @@ -89,14 +89,6 @@ public function __construct() { $this->tab_text = $this->title; } - // Define settings sections. - $this->settings_sections = array( - 'general' => array( - 'title' => $this->title, - 'callback' => array( $this, 'print_section_info' ), - ), - ); - // Register the settings section. $this->register_section(); @@ -140,15 +132,21 @@ public function register_section() { // Register settings sections. foreach ( $this->settings_sections as $name => $settings_section ) { + // Determine if this settings section needs to be wrapped in its own container. + $wrap = array(); + if ( $settings_section['wrap'] ) { + $wrap = array( + 'before_section' => $this->get_render_container_start(), + 'after_section' => $this->get_render_container_end(), + ); + } + add_settings_section( ( $name === 'general' ? $this->name : $this->name . '-' . $name ), $settings_section['title'], $settings_section['callback'], $this->settings_key, - array( - 'before_section' => $this->get_render_container_start(), - 'after_section' => $this->get_render_container_end(), - ) + $wrap ); } @@ -238,7 +236,7 @@ public function render() { } /** - * Performs actions after rendering of the settings form. + * Performs actions after rendering of the settings form. * * @since 1.9.6 */ diff --git a/admin/section/class-convertkit-settings-general.php b/admin/section/class-convertkit-settings-general.php index 9f258574..5259c9f1 100644 --- a/admin/section/class-convertkit-settings-general.php +++ b/admin/section/class-convertkit-settings-general.php @@ -62,10 +62,12 @@ public function __construct() { 'general' => array( 'title' => $this->title, 'callback' => array( $this, 'print_section_info' ), + 'wrap' => true, ), 'advanced' => array( 'title' => __( 'Advanced', 'convertkit' ), 'callback' => array( $this, 'print_section_info_advanced' ), + 'wrap' => true, ), ); From d2e5455fb0d85142ba8c11be8779facb03a5f9bc Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Thu, 16 Jan 2025 16:19:02 +0800 Subject: [PATCH 4/5] Coding standards --- ...ertkit-admin-settings-restrict-content.php | 6 ++--- ...s-convertkit-admin-settings-broadcasts.php | 2 +- .../class-convertkit-settings-general.php | 4 +-- ...convertkit-contactform7-admin-settings.php | 15 ++++++++--- ...s-convertkit-forminator-admin-settings.php | 27 +++++++++---------- ...ass-convertkit-wishlist-admin-settings.php | 27 +++++++++---------- 6 files changed, 42 insertions(+), 39 deletions(-) diff --git a/admin/class-convertkit-admin-settings-restrict-content.php b/admin/class-convertkit-admin-settings-restrict-content.php index 79584ab6..d9f054cc 100644 --- a/admin/class-convertkit-admin-settings-restrict-content.php +++ b/admin/class-convertkit-admin-settings-restrict-content.php @@ -37,17 +37,17 @@ public function __construct() { 'general' => array( 'title' => $this->title, 'callback' => array( $this, 'print_section_info' ), - 'wrap' => true, + 'wrap' => true, ), 'products' => array( 'title' => __( 'Products', 'convertkit' ), 'callback' => array( $this, 'print_section_info_products' ), - 'wrap' => true, + 'wrap' => true, ), 'tags' => array( 'title' => __( 'Tags', 'convertkit' ), 'callback' => array( $this, 'print_section_info_tags' ), - 'wrap' => true, + 'wrap' => true, ), ); diff --git a/admin/section/class-convertkit-admin-settings-broadcasts.php b/admin/section/class-convertkit-admin-settings-broadcasts.php index c30b08bc..b086cf8f 100644 --- a/admin/section/class-convertkit-admin-settings-broadcasts.php +++ b/admin/section/class-convertkit-admin-settings-broadcasts.php @@ -40,7 +40,7 @@ public function __construct() { 'general' => array( 'title' => $this->title, 'callback' => array( $this, 'print_section_info' ), - 'wrap' => true, + 'wrap' => true, ), ); diff --git a/admin/section/class-convertkit-settings-general.php b/admin/section/class-convertkit-settings-general.php index 5259c9f1..21cc03cc 100644 --- a/admin/section/class-convertkit-settings-general.php +++ b/admin/section/class-convertkit-settings-general.php @@ -62,12 +62,12 @@ public function __construct() { 'general' => array( 'title' => $this->title, 'callback' => array( $this, 'print_section_info' ), - 'wrap' => true, + 'wrap' => true, ), 'advanced' => array( 'title' => __( 'Advanced', 'convertkit' ), 'callback' => array( $this, 'print_section_info_advanced' ), - 'wrap' => true, + 'wrap' => true, ), ); diff --git a/includes/integrations/contactform7/class-convertkit-contactform7-admin-settings.php b/includes/integrations/contactform7/class-convertkit-contactform7-admin-settings.php index 2b271ad3..30652b72 100644 --- a/includes/integrations/contactform7/class-convertkit-contactform7-admin-settings.php +++ b/includes/integrations/contactform7/class-convertkit-contactform7-admin-settings.php @@ -30,6 +30,15 @@ public function __construct() { $this->title = __( 'Contact Form 7 Integration Settings', 'convertkit' ); $this->tab_text = __( 'Contact Form 7', 'convertkit' ); + // Define settings sections. + $this->settings_sections = array( + 'general' => array( + 'title' => $this->title, + 'callback' => array( $this, 'print_section_info' ), + 'wrap' => false, + ), + ); + parent::__construct(); } @@ -177,12 +186,12 @@ public function render() { // Register settings field. settings_fields( $this->settings_key ); - // Render submit button. - submit_button(); - // Render closing container. $this->render_container_end(); + // Render submit button. + submit_button(); + } /** diff --git a/includes/integrations/forminator/class-convertkit-forminator-admin-settings.php b/includes/integrations/forminator/class-convertkit-forminator-admin-settings.php index bce39235..d723f592 100644 --- a/includes/integrations/forminator/class-convertkit-forminator-admin-settings.php +++ b/includes/integrations/forminator/class-convertkit-forminator-admin-settings.php @@ -32,20 +32,17 @@ public function __construct() { $this->title = __( 'Forminator Integration Settings', 'convertkit' ); $this->tab_text = __( 'Forminator', 'convertkit' ); - parent::__construct(); - - } + // Define settings sections. + $this->settings_sections = array( + 'general' => array( + 'title' => $this->title, + 'callback' => array( $this, 'print_section_info' ), + 'wrap' => false, + ), + ); - /** - * Register fields for this section - * - * @since 2.3.0 - */ - public function register_fields() { + parent::__construct(); - // No fields are registered, because they are output in a WP_List_Table - // in this class' render() function. - // This function is deliberately blank. } /** @@ -172,12 +169,12 @@ public function render() { // Register settings field. settings_fields( $this->settings_key ); - // Render submit button. - submit_button(); - // Render closing container. $this->render_container_end(); + // Render submit button. + submit_button(); + } /** diff --git a/includes/integrations/wishlist/class-convertkit-wishlist-admin-settings.php b/includes/integrations/wishlist/class-convertkit-wishlist-admin-settings.php index d86248c6..d607a1f6 100644 --- a/includes/integrations/wishlist/class-convertkit-wishlist-admin-settings.php +++ b/includes/integrations/wishlist/class-convertkit-wishlist-admin-settings.php @@ -32,20 +32,17 @@ public function __construct() { $this->title = __( 'WishList Member Integration Settings', 'convertkit' ); $this->tab_text = __( 'WishList Member', 'convertkit' ); - parent::__construct(); - - } + // Define settings sections. + $this->settings_sections = array( + 'general' => array( + 'title' => $this->title, + 'callback' => array( $this, 'print_section_info' ), + 'wrap' => false, + ), + ); - /** - * Register fields for this section. - * - * @since 1.9.6 - */ - public function register_fields() { + parent::__construct(); - // No fields are registered, because they are output in a WP_List_Table - // in this class' render() function. - // This function is deliberately blank. } /** @@ -155,12 +152,12 @@ public function render() { // Register settings field. settings_fields( $this->settings_key ); - // Render submit button. - submit_button(); - // Render closing container. $this->render_container_end(); + // Render submit button. + submit_button(); + } /** From db76f6d604602c0de71504f38cc4110c086069f0 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Thu, 16 Jan 2025 17:10:38 +0800 Subject: [PATCH 5/5] Update button styling --- ...ertkit-admin-settings-restrict-content.php | 46 +++++++++---------- resources/backend/css/settings.css | 13 +++--- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/admin/class-convertkit-admin-settings-restrict-content.php b/admin/class-convertkit-admin-settings-restrict-content.php index d9f054cc..28fd282a 100644 --- a/admin/class-convertkit-admin-settings-restrict-content.php +++ b/admin/class-convertkit-admin-settings-restrict-content.php @@ -177,6 +177,22 @@ public function register_fields() { ) ); + // All. + add_settings_field( + 'subscribe_button_label', + __( 'Subscribe Button Label', 'convertkit' ), + array( $this, 'text_callback' ), + $this->settings_key, + $this->name, + array( + 'name' => 'subscribe_button_label', + 'label_for' => 'subscribe_button_label', + 'description' => array( + __( 'The text to display for the call to action button to subscribe.', 'convertkit' ), + ), + ) + ); + // Restrict by Product. add_settings_field( 'subscribe_heading', @@ -208,28 +224,12 @@ public function register_fields() { ) ); - // All. - add_settings_field( - 'subscribe_button_label', - __( 'Subscribe Button Label', 'convertkit' ), - array( $this, 'text_callback' ), - $this->settings_key, - $this->name, - array( - 'name' => 'subscribe_button_label', - 'label_for' => 'subscribe_button_label', - 'description' => array( - __( 'The text to display for the call to action button to subscribe.', 'convertkit' ), - ), - ) - ); - add_settings_field( 'email_text', __( 'Email Text', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name, + $this->name . '-products', array( 'name' => 'email_text', 'label_for' => 'email_text', @@ -244,7 +244,7 @@ public function register_fields() { __( 'Email Heading', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name, + $this->name . '-products', array( 'name' => 'email_heading', 'label_for' => 'email_heading', @@ -259,7 +259,7 @@ public function register_fields() { __( 'Email Field Description', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name, + $this->name . '-products', array( 'name' => 'email_description_text', 'label_for' => 'email_description_text', @@ -274,7 +274,7 @@ public function register_fields() { __( 'Email Button Label', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name, + $this->name . '-products', array( 'name' => 'email_button_label', 'label_for' => 'email_button_label', @@ -289,7 +289,7 @@ public function register_fields() { __( 'Email Check Heading', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name, + $this->name . '-products', array( 'name' => 'email_check_heading', 'label_for' => 'email_check_heading', @@ -304,7 +304,7 @@ public function register_fields() { __( 'Email Check Text', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name, + $this->name . '-products', array( 'name' => 'email_check_text', 'label_for' => 'email_check_text', @@ -319,7 +319,7 @@ public function register_fields() { __( 'No Access Text', 'convertkit' ), array( $this, 'text_callback' ), $this->settings_key, - $this->name, + $this->name . '-products', array( 'name' => 'no_access_text', 'label_for' => 'no_access_text', diff --git a/resources/backend/css/settings.css b/resources/backend/css/settings.css index 063cdbaf..9defc0df 100644 --- a/resources/backend/css/settings.css +++ b/resources/backend/css/settings.css @@ -105,10 +105,11 @@ body.settings_page__wp_convertkit_settings .wrap .postbox h2 { body.settings_page__wp_convertkit_settings .wrap .postbox p { font-size: 14px; } -body.settings_page__wp_convertkit_settings .wrap .postbox p.submit { +body.settings_page__wp_convertkit_settings p.submit { + margin-bottom: 20px; padding: 0; } -body.settings_page__wp_convertkit_settings .wrap .postbox .button { +body.settings_page__wp_convertkit_settings .button { margin: 0 5px 0 0; padding: 4px 12px; font-size: 14px; @@ -119,21 +120,21 @@ body.settings_page__wp_convertkit_settings .wrap .postbox .button { text-shadow: none; box-shadow: none; } -body.settings_page__wp_convertkit_settings .wrap .postbox .button-primary { +body.settings_page__wp_convertkit_settings .button-primary { background: #1e1e1e; border-color: #1e1e1e; color: #fff; } -body.settings_page__wp_convertkit_settings .wrap .postbox .button-primary:hover { +body.settings_page__wp_convertkit_settings .button-primary:hover { background: #3d3d3d; border-color: #3d3d3d; } -body.settings_page__wp_convertkit_settings .wrap .postbox .button-secondary { +body.settings_page__wp_convertkit_settings .button-secondary { background: #f0f0f0; border-color: #f0f0f0; color: #3d3d3d; } -body.settings_page__wp_convertkit_settings .wrap .postbox .button-secondary:hover { +body.settings_page__wp_convertkit_settings .button-secondary:hover { background: #ddd; border-color: #ddd; }