Skip to content

Header & Footer Banners Alignment#28

Merged
jasperf merged 3 commits into
mainfrom
header-footer-alignment
Jun 4, 2025
Merged

Header & Footer Banners Alignment#28
jasperf merged 3 commits into
mainfrom
header-footer-alignment

Conversation

@jasperf

@jasperf jasperf commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

This pull request introduces banner alignment options for header (wp_head) and footer (wp_footer) locations in the Banner Container Plugin, along with associated updates to the admin interface, CSS, and documentation. These changes enhance customization by allowing banners to be aligned left, center, or right, while maintaining backward compatibility with existing banners.

New Features and Enhancements:

  • Alignment Options for Header and Footer Banners:
    • Added alignment options (left, center, right) for banners in wp_head and wp_footer locations, configurable via a dropdown in the admin interface. [1] [2]
    • Alignment settings are applied through the CSS text-align property on wrapper classes (iwz-head-banner and iwz-footer-banner).
    • Default alignment is set to "left" for backward compatibility. [1] [2]

Codebase Updates:

  • Banner Alignment in Core Logic:

    • Updated wrap_banner_html method to include alignment as a parameter and apply alignment-specific classes. [1] [2]
    • Adjusted logic in display_header_banner, display_footer_banner, and their fallback methods to retrieve and apply alignment settings. [1] [2]
  • Admin Interface Enhancements:

    • Added dropdown fields for alignment settings in the banner configuration UI for applicable locations. [1] [2]
    • Updated JavaScript to dynamically include alignment options when adding new banners. [1] [2]

Documentation Updates:

  • Changelog and Versioning:
    • Updated CHANGELOG.md with details of the new alignment feature.
    • Incremented plugin version to 1.9.3 in iwz-banner-container-plugin.php.
  • README Enhancements:
    • Documented the alignment feature in the plugin description and usage instructions. [1] [2]

Minor Changes:

  • Updated the plugin's welcome page link to point to the correct website.

@jasperf jasperf requested a review from Copilot June 4, 2025 01:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds alignment options (left, center, right) for header and footer banners in the Banner Container Plugin while updating the admin UI, CSS, and documentation.

  • Introduces alignment configuration for banners via new dropdown fields in the admin settings and updates core banner display methods.
  • Updates legacy banner fallback and core wrapper generation to incorporate the new alignment parameter.
  • Revises plugin versioning and documentation to reflect the enhancements.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
iwz-banner-container-plugin.php Version bump updates for new alignment feature.
includes/class-iwz-banner-container.php Core logic updated to include alignment parameter for banner output.
includes/class-iwz-banner-container-welcome.php Updated welcome link URL changes.
includes/class-iwz-banner-container-settings.php Added alignment setting registration and UI enhancements; duplicate key removal needed.
README.md Documentation updated to describe the new alignment options.
CHANGELOG.md Changelog updated to capture the new alignment features.

$legacy_code = get_option( 'iwz_banner_wp_head_code', '' );
if ( ! empty( $legacy_code ) ) {
$this->output_body_banner_script( $legacy_code );
$wrapped_banner = $this->wrap_banner_html( $legacy_code, '', 'wp_head', $alignment );

Copilot AI Jun 4, 2025

Copy link

Choose a reason for hiding this comment

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

In the header banner fallback, the legacy banner code is passed directly without sanitization. For consistency with the non-fallback branch where sanitize_banner_html is applied, consider calling sanitize_banner_html on $legacy_code before wrapping.

Suggested change
$wrapped_banner = $this->wrap_banner_html( $legacy_code, '', 'wp_head', $alignment );
$sanitized_legacy_code = $this->sanitize_banner_html( $legacy_code );
$wrapped_banner = $this->wrap_banner_html( $sanitized_legacy_code, '', 'wp_head', $alignment );

Copilot uses AI. Check for mistakes.
Comment thread includes/class-iwz-banner-container-settings.php Outdated
@jasperf jasperf merged commit aaaf4fd into main Jun 4, 2025
5 checks passed
@jasperf jasperf deleted the header-footer-alignment branch June 4, 2025 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants