[wp-meta] [Making WordPress.org] #2106: WordPress.tv: Filter intended to prevent orphaned words creates them

Making WordPress.org noreply at wordpress.org
Tue Oct 4 02:22:18 UTC 2016


#2106: WordPress.tv: Filter intended to prevent orphaned words creates them
----------------------------+-----------------
 Reporter:  SergeyBiryukov  |      Owner:
     Type:  defect          |     Status:  new
 Priority:  normal          |  Milestone:
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).

--
Ticket URL: <https://meta.trac.wordpress.org/ticket/2106>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org


More information about the wp-meta mailing list