mundschenk-at / wp-typography

Improve your WordPress micro typography.
https://code.mundschenk.at/wp-typography/
Other
22 stars 3 forks source link

[Not a bug] Hyphens in title in tab tooltip #204

Closed strarsis closed 6 years ago

strarsis commented 6 years ago

Just encountered an interesting bug in Chrome, see https://bugs.chromium.org/p/chromium/issues/detail?id=592211. When hovering the tab in Chrome, soft-hyphens in title are shown. IMHO this is not a reason to not also add soft-hyphens to page title, ideally the browser could use this information later, e.g. better hyphenation in a multi-line title in the GUI.

mundschenk-at commented 6 years ago

This is one of the reasons we have WP_Typography::process_title_parts to strip out soft hyphens and zero-width spaces.

strarsis commented 6 years ago

@mundschenk-at: But I noticed this issue on a site. Does this mean the title is currently not stripped on that site?

mundschenk-at commented 6 years ago

How does your theme render the <title> tag?

strarsis commented 6 years ago

@mundschenk-at: I am using sage9 theme which uses blade: https://github.com/roots/sage/blob/e00eaf7e8fd8a5e63716ff31b5f0fc006171a8c4/resources/views/partials/page-header.blade.php

{!! App::title() !!}

{!!, !!} should print it unescaped. App::title()

mundschenk-at commented 6 years ago

Well, then that's the reason. Apparently the call to App::title() does not use any of the standard WordPress filter hooks for the document title (wp_title, wp_title_parts, document_title_parts). Instead, it appears to use the the_title hook intended for printing the post title as a heading.

mundschenk-at commented 6 years ago

I've had a look at the issue you created in the roots/sage repository. The thing is, the snippet you posted is not the function printing the <title> tag (sorry I missed that previously). roots/sage uses the wp_head() function in its head.blade.php partial, which should do the correct things.

roots/sage also declares theme-support for the title-tag feature, so I'm not sure what's going on unless you are somehow overriding some templates or using a really oldish WordPress version.