Making WordPress.org

Opened 18 months ago

Closed 2 months ago

#2106 closed defect (fixed)

WordPress.tv: Filter intended to prevent orphaned words creates them

Reported by: SergeyBiryukov Owned by: obenland
Milestone: Priority: normal
Component: WordPress.tv Keywords:


On WordPress.tv, there's a code that adds   before the last word in video titles.

I could not find it in the open sourced theme, but I guess it's similar to rosetta_orphan_control() in Rosetta:

 * Makes final space a non-breaking one, to prevent orphaned word.
 * @param string $string
 * @return string
function rosetta_orphan_control( $string ) {
	return substr_replace( $string, ' ', strrpos( $string, ' ' ), 1 );
add_filter( 'no_orphans', 'rosetta_orphan_control' );

The problem is that it doesn't work well for languages with longer words, see the screenshot.

As seen on http://wordpress.tv/event/wordcamp-moscow-2016/, this title does not wrap correctly with  :

Варвара Лялягина: Как стать идеальным заказчиком

The function should probably only replace spaces preceded by shorter words (1 to 3 letters or so).

Attachments (1)

meta-2106.PNG (26.5 KB) - added by SergeyBiryukov 18 months ago.

Download all attachments as: .zip

Change History (2)

#1 @obenland
2 months ago

  • Owner set to obenland
  • Resolution set to fixed
  • Status changed from new to closed

In 6380:

WordPress.tv: Roll our own widont.

On all index/archive screens, titles don't have a lot of room. The built-in minimum of 10 chars is not too helpful for this theme—let's see how 8 will fare.

Fixes #2106.

Note: See TracTickets for help on using tickets.