[wp-trac] [WordPress Trac] #28542: Navigating within Customizer preview should update parent document title

WordPress Trac noreply at wordpress.org
Sat Jun 21 06:17:48 UTC 2014


#28542: Navigating within Customizer preview should update parent document title
-----------------------------+-----------------------------
 Reporter:  westonruter      |       Owner:  ocean90
     Type:  feature request  |      Status:  reviewing
 Priority:  normal           |   Milestone:  Future Release
Component:  Customize        |     Version:  3.4
 Severity:  normal           |  Resolution:
 Keywords:  has-patch        |     Focuses:  ui, javascript
-----------------------------+-----------------------------

Comment (by westonruter):

 Replying to [comment:5 westonruter]:
 > Also: instead of `{{title}}` we should use `%1$s` and `%2$s`

 ocean90: Actually, this is problematic because in the case of the Live
 Preview title, we need to only substitute one of the strings, leaving the
 other for JavaScript later to supply the title. So this is what I came up
 with to implement the above change, but it's not too pretty:

 {{{#!diff
 --- src/wp-admin/customize.php
 +++ src/wp-admin/customize.php
 @@ -78,10 +78,12 @@ if ( is_rtl() ) {
  $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace(
 '_', '-', get_locale() ) ) );

  if ( $wp_customize->is_theme_active() ) {
 -       $document_title_tmpl = _x( 'Customize: {{title}}', '{{title}} is
 for JS template' );
 +       $document_title_tmpl = _x( 'Customize: %1$s', '2: document title'
 );
 +       $document_title_tmpl = sprintf( $document_title_tmpl, '{{title}}'
 );
  } else {
         $document_title_tmpl = sprintf(
 -               _x( 'Live Preview %s: {{title}}', '%s is theme name,
 {{title}} is for JS template' ),
 +               _x( 'Live Preview %2$s: %1$s', '1: document title, 2:
 theme name' ),
 +               '{{title}}',
                 strip_tags( $wp_customize->theme()->display( 'Name' ) )
         );
  }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28542#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list