Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure consistent header and sub header spacing between block and shortcode output #41

Merged
merged 4 commits into from
Jun 28, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions mailchimp_widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ function mailchimp_sf_signup_form( $args = array() ) {

// See if we have valid Merge Vars
if ( ! is_array( $mv ) ) {
echo wp_kses_post( $before_widget );
if ( ! empty( $before_widget ) ) {
echo wp_kses_post( $before_widget );
} else {
echo '<div class="mc_container">';
}
?>
<div class="mc_error_msg">
<?php
Expand All @@ -39,12 +43,18 @@ function mailchimp_sf_signup_form( $args = array() ) {
?>
</div>
<?php
echo wp_kses_post( $after_widget );
if ( ! empty( $after_widget ) ) {
echo wp_kses_post( $after_widget );
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should check for before_widget for the closing</div>, in the rare case that these args are being used for self-closing tags?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good point. There may be a scenario (hopefully edge case) where $before_widget is empty but $after_widget isn't (or vice versa) and we could end up having an opening tag with no closing or closing tag with no opening. Just pushed a fix that I think accounts for this: e9a2dc7

echo '</div>';
}
return;
}

if ( ! empty( $before_widget ) ) {
echo wp_kses_post( $before_widget );
} else {
echo '<div class="mc_container">';
}

$header = get_option( 'mc_header_content' );
Expand Down Expand Up @@ -72,7 +82,7 @@ function mailchimp_sf_signup_form( $args = array() ) {
}
#mc_subheader {
line-height: 1.25em;
margin-bottom: 18px;
margin: 18px 0;
}
.mc_merge_var {
margin-bottom: 1.0em;
Expand Down Expand Up @@ -274,6 +284,8 @@ function mailchimp_sf_signup_form( $args = array() ) {
<?php
if ( ! empty( $after_widget ) ) {
echo wp_kses_post( $after_widget );
} else {
echo '</div>';
}
}

Expand Down
Loading