Skip to content

bcc-login: the site's logo in the BCC topbar v2 - #276

Merged
cs1m0n merged 3 commits into
masterfrom
feature/topbar-v2-site-logo
Dec 4, 2026
Merged

cs1m0n merged 3 commits into
masterfrom
feature/topbar-v2-site-logo

Conversation

@cs1m0n

@cs1m0n cs1m0n commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Built on #275 (the topbar setting), which is merged and released as bcc-login 1.3.4.

What

  • The site's logo in the bar: the bar gets the theme's logo, both when the bcc-login setting adds it and when the [bcc-topbar-v2] shortcode does.
    • It comes from the theme's custom logo (Appearance → Customize → Site Identity).
    • On a block theme, WordPress returns the Site Logo block's logo as the same custom logo, so that works too.
  • Link and name: the logo links to the front page in the page's language (Polylang pll_home_url(), otherwise WPML's wpml_home_url) and is named after the site.
  • No logo: nothing is passed, and the bar keeps the BCC logo linked to bcc.no.
  • Shortcode: logo="https://…/white.svg" and logo-href="…" give the bar another image or link. logo="" keeps the BCC logo.
  • Filter: bcc_topbar_v2_logo can change url, href and alt. An empty url keeps the BCC logo.
  • Docs: docs/signon/configuration.md.

It needs the widget's logo, logo-href and logo-alt attributes 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

  • Refused addresses: the logo's address is escaped before it is checked. An address esc_url() refuses (a data: URI) now leaves out the link and the name too, so the bar keeps the BCC logo linked to bcc.no.
  • Paths: a path without a leading slash (logo="wp-content/…", logo-href="en/") is read from the front page. Before, esc_url() turned it into http://wp-content/….
  • Attachment id: logo="123" takes a media library image by its id.
  • Image size: a media library logo is served at the 768px size where WordPress made one, not the original upload.
  • Filter results: values the filter returns that aren't text (an array) count as no logo, without a PHP warning.
  • Visitor search language: the visitors' search now goes to the front page in the page's language too. Polylang adds the language to home_url() only for code in a theme's files, and a block theme's wp_head runs from core.
  • Docs and comments: the search URL's docblock is back on its function. The shortcode comment and the docs list logo and logo-href. The docs say the Customizer preview doesn't show the bar.
  • Not changed: the theme's logo is used automatically, without a setting to turn it off. That was the chosen design: sites without a logo keep the BCC logo, and the filter or the CSS property covers the rest.

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_option filters, so nothing was written.

Site / case data-logo data-logo-href data-logo-alt
bccnorge, setting route …/BCC-Norge-logo-RGB.svg https://bccnorge.local/ BCC Norge
bccnorge, [bcc-topbar-v2] the same the same the same
bccnorge, logo="" – – –
bccnorge, logo="https://example.org/white.svg" logo-href="/en/" https://example.org/white.svg /en/ BCC Norge
filter changes alt to Ræv & Co "x" logo front page escaped once: Ræv & Co "x"
filter returns url empty, or not an array – – –
bcckids (WPML), stand-in logo, Norwegian image https://bcckids.local/no/ the Norwegian site name
bcckids, WPML switched to English image https://bcckids.local/en/ the English site name
bcckids, WPML switched to German image https://bcckids.local/de/ Bible Kids
bccnorge, logo="wp-content/uploads/white.svg" logo-href="en/" https://bccnorge.local/wp-content/uploads/white.svg https://bccnorge.local/en/ BCC Norge
bccnorge, logo="93890" (the theme logo's id) …/BCC-Norge-logo-RGB.svg front page BCC Norge
bccnorge, logo="data:image/svg+xml,…" – – –
filter returns an array for url – (no warning) – –
bcckids, English, PNG logo …-768x432.png https://bcckids.local/en/ English name; visitor search https://bcckids.local/en/?s=

php -l passes.

🤖 Generated with Claude Code

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>
@cs1m0n cs1m0n self-assigned this Dec 4, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cs1m0n
cs1m0n changed the base branch from feature/topbar-version-setting to master December 4, 2026 09:41
- 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>
@cs1m0n
cs1m0n merged commit 9818e52 into master Dec 4, 2026
7 checks passed
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.

1 participant