Skip to content

Fix Customizer preview showing an empty featured-pages block - #64

Open
deepench wants to merge 1 commit into
developfrom
fix/customizer-preview-empty-featured-pages
Open

deepench wants to merge 1 commit into
developfrom
fix/customizer-preview-empty-featured-pages

Conversation

@deepench

@deepench deepench commented Sep 29, 2026 •

Copy link
Copy Markdown

Related to themegrill/radiate-pro#46 (same root cause, both editions)

Changes proposed in this Pull Request:

Same bug as reported for Radiate Pro: on a static front page with no featured pages ever selected, the Customizer preview showed an empty #featured_pages wrapper that the published front end doesn't render. Root cause: front-page.php checked $page_array[...] != 0, a loose comparison. Inside the Customizer preview, an unsaved setting resolves to its registered default (an empty string ''), and under PHP 8 comparing a non-numeric string against an integer coerces the int to string, so '' != 0 becomes true -- the guard opens and WP_Query runs with a post__in that matches nothing, leaving an empty wrapper. On the published front end the same call returns false, false != 0 is false, so nothing renders there.

Fixed by giving each get_theme_mod() call an explicit 0 default and switching the guard to ! empty().

Before (empty gap, outlined red) After (no gap)
Before: empty featured-pages gap After: no gap

(screenshots pushed to the evidence-pr-64 branch for this PR only -- fine to delete once reviewed)

How to test the changes in this Pull Request:

  1. Set up a static front page (Settings > Reading > "A static page") with no featured pages ever selected in Customizer > Front Page Featured Section.
  2. Open Appearance > Customize and look at the front page in the preview pane -- there should be no empty gap between the header and the content.
  3. Open the same URL in a normal window (outside the Customizer) -- confirm it already looked fine there (this fix is preview-only).
  4. Select an actual featured page and confirm it still renders correctly in both the preview and the published page.

Types of changes:

  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (modification of the currently available functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Other information:

  • Have you added an explanation of what your changes do and why you would like us to include them?
  • Have you successfully ran tests with your changes locally?
  • Have you updated the documentation accordingly?

Changelog entry

Fix - Customizer preview no longer shows an empty featured-pages gap when none are selected.

@tg-autopilot
tg-autopilot requested a lite review from Copilot September 29, 2026 06:45
@github-actions

Copy link
Copy Markdown

QA suite — refused, no regression spec

This PR changes product source but adds no spec, so the suite was
refused before booting WordPress — running it just to report the same
thing at the end costs runner minutes for nothing. Run
/claudegrill:verify-fix locally and let write-spec add the guard
to this branch, then push again.

Source files changed with no matching spec
front-page.php

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.

Copilot review overview

🟢 Approval recommended

The focused fix addresses the preview issue with no unresolved review concerns.

Review effort: Lite
Findings: None

What changed in this PR

Fixes the Customizer preview displaying an empty featured-pages block when no pages are selected.

Changes:

  • Defaults featured-page settings to 0.
  • Prevents rendering when no featured pages are selected.
File Description
front-page.php Corrects featured-page defaults and rendering guard.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@deepench
deepench requested a review from subin-shk September 30, 2026 08:32
@deepench deepench self-assigned this Sep 30, 2026
@deepench deepench added the bug label Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants