diff --git a/admin/section/class-convertkit-settings-general.php b/admin/section/class-convertkit-settings-general.php
index fea9cde9..fd7cb834 100644
--- a/admin/section/class-convertkit-settings-general.php
+++ b/admin/section/class-convertkit-settings-general.php
@@ -337,7 +337,7 @@ public function register_fields() {
add_settings_field(
'non_inline_form',
- __( 'Default Form (Site Wide)', 'convertkit' ),
+ __( 'Default Forms (Site Wide)', 'convertkit' ),
array( $this, 'non_inline_form_callback' ),
$this->settings_key,
$this->name,
@@ -657,7 +657,7 @@ public function non_inline_form_callback( $args ) {
$preview_url = WP_ConvertKit()->get_class( 'preview_output' )->get_preview_form_home_url();
$description = sprintf(
'%s %s %s',
- esc_html__( 'Select a non-inline modal, slide in or sticky bar form to automatically display site wide. Ignored if a non-inline form is specified in Default Form settings above, individual Post / Page settings, or any block / shortcode.', 'convertkit' ),
+ esc_html__( 'Select one or more non-inline modal, slide in or sticky bar forms to automatically display site wide. Ignored if a non-inline form is specified in Default Form settings above, individual Post / Page settings, or any block / shortcode.', 'convertkit' ),
'' . esc_html__( 'Click here', 'convertkit' ) . '',
esc_html__( 'to preview how this will display.', 'convertkit' )
);
@@ -671,9 +671,7 @@ public function non_inline_form_callback( $args ) {
'convertkit-preview-output-link',
),
$this->settings->get_non_inline_form(),
- array(
- '' => esc_html__( 'None', 'convertkit' ),
- ),
+ false,
array(
'data-target' => '#convertkit-preview-non-inline-form',
'data-link' => esc_attr( $preview_url ) . '&convertkit_form_id=',
diff --git a/includes/class-convertkit-output.php b/includes/class-convertkit-output.php
index 8500f3e2..2b2090ea 100644
--- a/includes/class-convertkit-output.php
+++ b/includes/class-convertkit-output.php
@@ -803,8 +803,8 @@ public function get_subscriber_id_from_request() {
}
/**
- * Outputs a non-inline form if defined in the Plugin's settings >
- * Default Non-Inline Form (Global) setting.
+ * Outputs a non-inline forms if defined in the Plugin's settings >
+ * Default Forms (Site Wide) setting.
*
* @since 2.3.3
*/
@@ -822,28 +822,33 @@ public function output_global_non_inline_form() {
// Get form.
$convertkit_forms = new ConvertKit_Resource_Forms();
- $form = $convertkit_forms->get_by_id( (int) $this->settings->get_non_inline_form() );
- // Bail if the Form doesn't exist (this shouldn't happen, but you never know).
- if ( ! $form ) {
- return;
- }
+ // Iterate through forms.
+ foreach ( $this->settings->get_non_inline_form() as $form_id ) {
+ // Get Form.
+ $form = $convertkit_forms->get_by_id( (int) $form_id );
- // Add the form to the scripts array so it is included in the output.
- add_filter(
- 'convertkit_output_scripts_footer',
- function ( $scripts ) use ( $form ) {
+ // Bail if the Form doesn't exist (this shouldn't happen, but you never know).
+ if ( ! $form ) {
+ continue;
+ }
- $scripts[] = array(
- 'async' => true,
- 'data-uid' => $form['uid'],
- 'src' => $form['embed_js'],
- );
+ // Add the form to the scripts array so it is included in the output.
+ add_filter(
+ 'convertkit_output_scripts_footer',
+ function ( $scripts ) use ( $form ) {
- return $scripts;
+ $scripts[] = array(
+ 'async' => true,
+ 'data-uid' => $form['uid'],
+ 'src' => $form['embed_js'],
+ );
- }
- );
+ return $scripts;
+
+ }
+ );
+ }
}
diff --git a/includes/class-convertkit-preview-output.php b/includes/class-convertkit-preview-output.php
index 5eb80465..685985be 100644
--- a/includes/class-convertkit-preview-output.php
+++ b/includes/class-convertkit-preview-output.php
@@ -72,7 +72,7 @@ public function preview_form( $form_id ) {
}
/**
- * Adds a non-inline form for display if the request is from a logged in user who has clicked a preview link
+ * Adds non-inline form(s) for display if the request is from a logged in user who has clicked a preview link
* and is viewing the home page.
*
* @since 2.3.3
@@ -99,33 +99,40 @@ public function preview_non_inline_form() {
return;
}
- // Determine the form to preview.
- $preview_form_id = (int) ( isset( $_REQUEST['convertkit_form_id'] ) ? sanitize_text_field( $_REQUEST['convertkit_form_id'] ) : 0 );
+ // Bail if no form(s) to preview.
+ if ( ! isset( $_REQUEST['convertkit_form_id'] ) ) {
+ return;
+ }
- // Get form.
+ // Determine form ID(s) to preview.
$convertkit_forms = new ConvertKit_Resource_Forms();
- $form = $convertkit_forms->get_by_id( $preview_form_id );
+ $preview_form_ids = explode( ',', sanitize_text_field( $_REQUEST['convertkit_form_id'] ) );
- // Bail if the Form doesn't exist (this shouldn't happen, but you never know).
- if ( ! $form ) {
- return;
- }
+ foreach ( $preview_form_ids as $preview_form_id ) {
+ // Get form.
+ $form = $convertkit_forms->get_by_id( (int) $preview_form_id );
- // Add the form to the scripts array so it is included in the preview.
- add_filter(
- 'convertkit_output_scripts_footer',
- function ( $scripts ) use ( $form ) {
+ // Bail if the Form doesn't exist (this shouldn't happen, but you never know).
+ if ( ! $form ) {
+ continue;
+ }
- $scripts[] = array(
- 'async' => true,
- 'data-uid' => $form['uid'],
- 'src' => $form['embed_js'],
- );
+ // Add the form to the scripts array so it is included in the preview.
+ add_filter(
+ 'convertkit_output_scripts_footer',
+ function ( $scripts ) use ( $form ) {
- return $scripts;
+ $scripts[] = array(
+ 'async' => true,
+ 'data-uid' => $form['uid'],
+ 'src' => $form['embed_js'],
+ );
- }
- );
+ return $scripts;
+
+ }
+ );
+ }
}
diff --git a/includes/class-convertkit-resource-forms.php b/includes/class-convertkit-resource-forms.php
index d4f4ab74..84466858 100644
--- a/includes/class-convertkit-resource-forms.php
+++ b/includes/class-convertkit-resource-forms.php
@@ -154,23 +154,23 @@ public function get_select_field_all( $name, $id, $css_classes, $selected_option
*
* @since 2.3.9
*
- * @param string $name Name.
- * @param string $id ID.
- * @param bool|array $css_classes