WordPress.org

Making WordPress.org

Opened 15 months ago

#2106 new defect

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

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

Description

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 15 months ago.

Download all attachments as: .zip

Change History (1)

Note: See TracTickets for help on using tickets.