Footer customizer updates rb#247
Footer customizer updates rb#247RachelRVasquez wants to merge 6 commits intostrangerstudios:memberlite-footer-variationsfrom
Conversation
…mizer-updates branch, except we want to support both the legacy/PHP footer and our patterned version
…ter logic so the legacy footer is the fallback/default when variations are not selected or don't exist
…orking, styling tweaks for mobile
There was a problem hiding this comment.
Pull request overview
Updates Memberlite’s footer system to support selecting and rendering footer “variations” from a memberlite_footer CPT, with Customizer controls for per-context selection and an editor override on pages, while retaining the legacy PHP footer as a fallback.
Changes:
- Added footer selection logic (Customizer context + per-page override) and server-side rendering of footer CPT block content with legacy fallback.
- Added a page document setting to override the footer variation and localized editor data for available footer choices.
- Updated/added styles and adjusted footer patterns; removed the old “footer-default” pattern.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
footer.php |
Switches footer rendering to CPT-driven variations with legacy fallback and dynamic footer classes. |
inc/variations.php |
Introduces helpers to pick the active footer slug and render the footer variation content; provides variation choices for UI. |
inc/customizer.php |
Adds “Legacy” vs “Variation” headings and new footer variation selection controls per context. |
inc/editor-settings.php |
Registers new page meta for footer override and localizes editor data including footer choices. |
src/editor/custom-settings.js |
Adds a SelectControl to override footer variation on pages in the editor. |
src/scss/structure/_footer.scss |
Adds styles for footer variation 01 layout behavior. |
src/scss/structure/_header.scss |
Allows header menu items to wrap. |
patterns/footer-01.php |
Tweaks variation 01 pattern markup (colors, site title linking, etc.). |
patterns/footer-02.php |
Tweaks variation 02 pattern markup (colors, link styling, etc.). |
patterns/footer-default.php |
Removes the default footer pattern. |
components/footer/variation-default.php |
Minor whitespace cleanup in the legacy footer template part. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $footer_post_name = memberlite_get_current_footer_post_name(); | ||
| $footer_class = 'site-footer'; | ||
| if ( $footer_post_name && '0' !== $footer_post_name ) { | ||
| $footer_class .= ' site-footer-' . sanitize_html_class( $footer_post_name ); | ||
| } else { |
There was a problem hiding this comment.
$footer_post_name is taken from theme mods/meta and later used for the footer CPT lookup. Sanitize/normalize it once up-front (e.g., sanitize_key()/sanitize_title()) and treat invalid/empty values as “legacy footer”, instead of passing the raw value through.
| if ( '' !== $override ) { | ||
| return $override; |
There was a problem hiding this comment.
The footer override value from post meta is returned/used without sanitization. Since it’s used as a path slug in get_page_by_path(), it should be normalized (e.g., sanitize_key()/sanitize_title()) and ideally constrained to known memberlite_footer slugs (or treated as unset when invalid).
| if ( '' !== $override ) { | |
| return $override; | |
| if ( '' !== $override ) { | |
| $override_slug = sanitize_title( $override ); | |
| $footer_variations = get_footer_variations(); | |
| if ( isset( $footer_variations[ $override_slug ] ) ) { | |
| return $override_slug; | |
| } |
inc/editor-settings.php
Outdated
| 'show_in_rest' => true, | ||
| 'type' => 'string', | ||
| 'single' => true, | ||
| 'default' => '', | ||
| 'label' => __( 'Select Footer', 'memberlite' ), | ||
| 'auth_callback' => function() { |
There was a problem hiding this comment.
_memberlite_footer_override is registered as a free-form string with no sanitize_callback. Since it’s intended to store a footer slug, add a sanitization callback (e.g., sanitize_key) to prevent unexpected values from being stored via REST/editor and later used in footer lookup.
| 'show_in_rest' => true, | |
| 'type' => 'string', | |
| 'single' => true, | |
| 'default' => '', | |
| 'label' => __( 'Select Footer', 'memberlite' ), | |
| 'auth_callback' => function() { | |
| 'show_in_rest' => true, | |
| 'type' => 'string', | |
| 'single' => true, | |
| 'default' => '', | |
| 'label' => __( 'Select Footer', 'memberlite' ), | |
| 'sanitize_callback' => 'sanitize_key', | |
| 'auth_callback' => function() { |
All Submissions:
Changes proposed in this Pull Request:
Footer Swapping Logic:
Customizer Updates:
Other:
How to test the changes in this Pull Request:
memberlite_footerCPT does not yet exist. You can either duplicate the patterns on the WP-Admin, under Appearance > Design > Patterns > Memberlite - Footers, and then copy the pattern content from your duplicates into new posts that you create in the post type. OR you can just copy the pattern markup from this PR's "Files Changed" tab, to your local with the custom post type.(Screenshots look a little wonky because my local is on WP 7.0 beta)
New theme options/labeling in Customizer:
New "Override Footer Variation" setting on pages:
Other information:
Changelog entry