Sorry, still seeing ­s unless <h1> and <h2> are excluded …
Plugin Author
pepe
(@pputzer)
What version of Catch Box are you using? I’m a bit stumped here. I could reproduce the problem with Twenty Fourteen, but not with Catch Box (which does not trigger the wp_title filter at all in its current release, although I’ve not found any code in it that messes with wp_title).
Catch Box 4.3.6 (which should be the latest and greatest version). Catch Box sets add_theme_support( 'title-tag' ).
Just tried to understand the code. As far as I can see, WP_Typography::process_title() is registered as a filter for any type of title. As I can prove using some debug code, it is called for <title>. WP_Typography::process_title() calls WP_Typography::process(), which calls PHP_Typography::process(). Within PHP_Typography::process(), there is nothing which stops process_words() from being called for the content of <title>. Consequently, the content of <title> is hyphenated.
The functionality to exclude <h1> and <h2> in order to exclude <title> is mentioned in the readme and the changelog – looks like that has been an issue long time ago …
Plugin Author
pepe
(@pputzer)
I’ve researched the issue a bit and there has been a change in how titles are handled in WordPress 4.4. Previously, the filter wp_title was used – that’s what I handle in wp-Typography 3.2.4.
Since WP 4.4, that filter is not triggered anymore. Instead, there is a new filter document_title_parts. wp-Typography currently does NOT touch that filter and in my minimal test environment, WP_Typography::process() is not called for themes with `add_theme_support( ‘title-tag’ ) – that’s why I could not reproduce this at first.
The various filter hooks called *title (starting in https://github.com/mundschenk-at/wp-typography/blob/ed9d8deb8fa78c76189759115fd44261b71c0739/includes/class-wp-typography.php#L224) refer to post titles (i.e. <h1>), not to the <title> tag.
I´ve added an echo ("<!-- PHP_Typography:process('" . $html . "') -->"); right after the first if-statement in PHP_Typography:process() and I can see the comment right before <title> in the generated HTML code.
Adding a debug_print_backtrace() proves that it comes from WP_Typography->process_title.
To be exact, it comes from apply_filters(single_post_title) which you hook in class-wp-typography.php.
Plugin Author
pepe
(@pputzer)
Thanks, that has put me on the right track. This stems from wp_get_document_title using the various title template tags to populate the <title> tag when not on the front page.
There actually was a bug in PHP_Typography that prevented Hyphenate headings from working correctly ($is_title was not passed on to process_words), but I think I’ll also create a special filter for document_title_parts that strips out any or zero-width space characters that may have crept in.
Plugin Author
pepe
(@pputzer)
Please have a look at version 3.2.5.
Got a whitescreen issue on the blog front page. Had to disable the plugin.
Actually, pages and posts do work. Only the front page is broken.
Pages and posts look pretty good: <title> isn´t hyphenated any more and the “hyphenate headings” setting seems to do what it is supposed to do. Only titles passed to other plugins (in my case: Add Metatags) are still hyphenated.
Plugin Author
pepe
(@pputzer)
The autoloading issue is fixed in 3.2.6. Can’t do much about how other plugins use template tags (you might want to have the contents of the single_post_title hyphenated if used as <h1>).
Perfect :-). Thanks a lot for your help – and thanks a lot for this great plugin!
By the way: You might want to get rid of that if-statement referring to the exclusion of <h1> and <h2> at the very beginning of PHP_Typography::process(). After today´s fixes, these lines of code seem to be some sort of a “leftover” from an (outdated) workaround, aren´t they?
Thanks again for your help :-).