Repository navigation
bcc-login: the site's logo in the BCC topbar v2 - #276
Merged
Merged
Conversation
The bar gets the theme's logo (custom_logo; in a block theme the Site Logo block, which WordPress returns as the same theme mod), linked to the front page in the page's language (Polylang, WPML) and named after the site. Without a logo, nothing is passed and the bar keeps the BCC logo. The shortcode's logo and logo-href give the bar another image or link (logo="" for the BCC logo), and the filter bcc_topbar_v2_logo can change url, href and alt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The logo's address is escaped before it is checked, so one esc_url() refuses (a data: URI) leaves out the link
and the name too, and the bar keeps the BCC logo to bcc.no.
- A path without a leading slash ("wp-content/…", logo-href="en/") is read from the front page; esc_url() made it
"http://wp-content/…". logo="123" takes a media library image by id.
- A media library logo comes in the 768 pixel size where there is one, not as uploaded.
- What the filter gives back is checked: a value that isn't text (an array) counts as none, without a warning.
- The visitors' search goes to the front page in the page's language too (Polylang filters home_url() only from
a theme's files, and a block theme's wp_head runs from wp-includes).
- The search URL's docblock is back on its function; the shortcode's comment and the docs list logo and logo-href,
and the docs say the Customizer's preview doesn't show the bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Built on #275 (the topbar setting), which is merged and released as bcc-login 1.3.4.
What
[bcc-topbar-v2]shortcode does.pll_home_url(), otherwise WPML'swpml_home_url) and is named after the site.logo="https://…/white.svg"andlogo-href="…"give the bar another image or link.logo=""keeps the BCC logo.bcc_topbar_v2_logocan changeurl,hrefandalt. An emptyurlkeeps the BCC logo.docs/signon/configuration.md.It needs the widget's
logo,logo-hrefandlogo-altattributes from bcc-code/bcc-widgets#579. Merge #579 first. If this is released before the widget, the bar ignores the new attributes and shows the BCC logo, which is harmless, but the docs would describe something that doesn't work yet. Merging releases a new bcc-login.Sites whose theme logo is dark (bccnorge and bccinternational: the bar's own green) need
bcc-topbar-v2 { --bcc-topbar-v2-logo-filter: brightness(0) invert(1); }in their CSS, or the logo won't show on the bar.After the review
esc_url()refuses (adata:URI) now leaves out the link and the name too, so the bar keeps the BCC logo linked to bcc.no.logo="wp-content/…",logo-href="en/") is read from the front page. Before,esc_url()turned it intohttp://wp-content/….logo="123"takes a media library image by its id.home_url()only for code in a theme's files, and a block theme'swp_headruns from core.logoandlogo-href. The docs say the Customizer preview doesn't show the bar.Checked
Read-only, in the local DevKinsta sites with wp-cli. All plugins except the installed bcc-login were loaded, and the branch's classes were loaded in its place. Settings came from
pre_optionfilters, so nothing was written.data-logodata-logo-hrefdata-logo-alt…/BCC-Norge-logo-RGB.svghttps://bccnorge.local/[bcc-topbar-v2]logo=""logo="https://example.org/white.svg" logo-href="/en/"https://example.org/white.svg/en/alttoRæv & Co "x"Ræv & Co "x"urlempty, or not an arrayhttps://bcckids.local/no/https://bcckids.local/en/https://bcckids.local/de/logo="wp-content/uploads/white.svg" logo-href="en/"https://bccnorge.local/wp-content/uploads/white.svghttps://bccnorge.local/en/logo="93890"(the theme logo's id)…/BCC-Norge-logo-RGB.svglogo="data:image/svg+xml,…"url…-768x432.pnghttps://bcckids.local/en/https://bcckids.local/en/?s=php -lpasses.🤖 Generated with Claude Code