Site Logo: show the current logo in WP Admin General Settings#50764
Site Logo: show the current logo in WP Admin General Settings#50764taipeicoder wants to merge 19 commits into
Conversation
The "Site Logo" field on the General Settings page rendered only the Fiverr upsell and never read the stored logo, so it always looked empty even when a logo had been set from the Site Editor's Identity section. Read the current logo (site_logo option, falling back to the custom_logo theme mod) and render a preview when one is set, keeping the Fiverr CTA as the empty state. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report Coverage check overridden by
I don't care about code coverage for this PR
|
Address review feedback on the WP Admin General Settings logo preview: - Request a proportional image size instead of a square, so wide wordmarks are no longer shown as a center-cropped fragment; cap the dimensions in CSS. - Give the image an explicit alt, falling back to the site title when the attachment has none, so the populated state is announced to screen readers. - Normalize the site_logo option (attachment ID, legacy array, or WP_Error) before casting, avoiding a warning and a bogus attachment ID. - Render the preview on a checkerboard surface so white, dark, and transparent logos all stay visible; use logical CSS properties. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The custom_logo theme-mod fallback was cast to int without the same guard used for the site_logo option. Core's site-logo filter can surface a WP_Error through either source, so casting the fallback directly could emit a warning and produce attachment ID 1. Route both candidate values through a shared normalization helper that only yields a positive scalar ID. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
wp_get_attachment_image() emits explicit width/height attributes, so clamping only one axis let the two max constraints distort non-square logos. Set both inline-size and block-size to auto so the image scales proportionally within the bounds. Make the preview container block-level but shrink-wrapped so the Fiverr button stays below it, matching the empty state across viewport widths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The previous tile contrast (#fff vs #f0f0f1) was too subtle to reveal white or near-white transparent logos, leaving the row looking blank. Use medium-gray tiles over a light base so both white and dark logos remain legible. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collapse the four-layer linear-gradient checkerboard into a single conic-gradient, dropping the hand-tuned background-position offsets. Drop the redundant display: block on the div, use consistent truthy id guards, and trim the normalization docblock. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The single conic-gradient can't satisfy stylelint here: it exceeds the 80-column limit on one line, but the config also forbids breaking a function's arguments across lines. Restore the four-layer linear-gradient form, which lints cleanly. The other simplifications (dropped redundant display, consistent guards) stand. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Show the "Make an incredible logo in minutes" promo text in both states rather than only the empty state, so it reads as persistent helper copy under the field (like the site-address domain description) with the logo preview above it when one is set. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move the promo text beneath the "Try Fiverr Logo Maker" button and mark it up as a p.description, matching the site-address helper text, so the button leads and the copy reads as supporting description. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…reen Replace the promo copy with text explaining that the logo displays via the Site Logo block, and link "You can change your site logo in the site editor" to the Site Editor identity screen. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Lay the field out as a wrapping flex row so the logo preview and the Fiverr button share the first line and the description spans a full-width line beneath them. Size the preview to sit compactly next to the button, and end the description sentence with a period. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Only apply the new preview and description to the logo-present state; when no logo is set, keep the original Fiverr promo copy and button unchanged. Extract the shared button markup into a helper so both states reuse it. Link to the Site Editor's Identity screen only on block themes, where it exists; classic themes have no Site Editor, so point them at the Customizer's logo control instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Resolve the logo edit destination through a helper: on block themes, deep-link to the Site Editor's Identity screen only when the route is available (Gutenberg 22.8 / WordPress 7.1), otherwise fall back to the default Site Editor. On classic themes, target the Customizer control that matches the theme's logo integration (custom_logo or site_logo), matching the logo-tool feature. Let the preview row wrap so the button drops below the preview on narrow screens instead of overflowing, and cap the preview at the container width. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A classic theme without custom-logo or site-logo support can still show a preview from a leftover site_logo option, but its Customizer has no logo control. Return an empty URL in that case and skip the description so the UI does not promise an edit path that leads nowhere. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Dropping to the generic Site Editor when the Identity screen is unavailable could be a dead end (no logo control if the active templates lack a Site Logo block), and the accompanying copy would overclaim. Return an empty URL in that case so the description is omitted, and only show the change link where Identity is available. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fall back to "Current site logo" when the site title is empty, instead of "Current site logo for " with a dangling preposition. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Trim the verbose explanatory comments in the options-general PHP and SCSS to concise one- or two-liners; no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Use 4px preview padding and a 30px image cap so the preview totals 40px (30 + 4px padding + 1px border each side), aligning it with the button, and tighten the row gap to 10px. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Proposed changes
site_logooption, falling back to thecustom_logotheme mod, which core keeps in sync) and shows a preview when one is set. The Fiverr CTA becomes the empty state, shown only when no logo exists; the "Try Fiverr Logo Maker" button remains available in both states.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Appearance → Editor), then reload Settings → General.