Opened 8 years ago

Closed 6 years ago

#2106 closed defect (bug) (fixed) Filter intended to prevent orphaned words creates them

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: obenland's profile obenland
Milestone: Priority: normal
Component: Keywords:


On, 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, 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 8 years ago.

Download all attachments as: .zip

Change History (2)

#1 @obenland
6 years ago

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

In 6380: 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.