[wp-trac] [WordPress Trac] #43466: Add ltr admin body class

WordPress Trac noreply at wordpress.org
Mon Mar 5 10:53:49 UTC 2018


#43466: Add ltr admin body class
----------------------------+------------------------------
 Reporter:  birgire         |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  low             |   Milestone:  Awaiting Review
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  good-first-bug  |     Focuses:
----------------------------+------------------------------

Comment (by birgire):

 @SergeyBiryukov  Thanks for checking out the other admin files.

 I see that there's also no {{{dir="ltr"}}} for the {{{<html>}}} tag, just
 {{{dir="rtl"}}}:

 {{{
 $dir_attr = '';
 if ( is_rtl() ) {
         $dir_attr = ' dir="rtl"';
 }

 }}}

 in {{{wp-includes/load.php}}}:

 I was just speculating about various possible options to avoid
 complicating things with PHP and {{{is_rtl()}}} in inline admin styling.

 Here's an example from the [http://wordpress.org/plugins/health-check/
 Health Check] plugin, related to #39165
 [https://plugins.trac.wordpress.org/browser/health-check/tags/1.0.1/pages
 /debug-data.php#L215 src]:

 {{{
  <span style="display: block; width: 100%; text-align: <?php echo (
 is_rtl() ? 'left' : 'right' ); ?>">
      <a href="#system-information-table-of-contents" class="debug-
 toc"><?php esc_html_e( 'Return to table of contents' ); ?></a>
  </span>

 }}}

 Here's an example from ''Hello Dolly'' plugin (1.6):

 {{{
 // We need some CSS to position the paragraph
 function dolly_css() {
         // This makes sure that the positioning is also good for right-to-
 left languages
         $x = is_rtl() ? 'left' : 'right';

         echo "
         <style type='text/css'>
         #dolly {
                 float: $x;
                 padding-$x: 15px;
                 padding-top: 5px;
                 margin: 0;
                 font-size: 11px;
         }
         </style>
         ";
 }

 }}}

 This could be written in pure (enqueued) CSS, using {{{.rtl}}} to help
 override float and padding directions.

 Another approach could be to not use an override, but use both {{{.rtl}}}
 and {{{.ltr}}} for the float and padding directions. But if that's against
 best practices then we shouldn't.

 There are also tools that can auto-generate the rtl stylesheet (like core
 is using).

 There's also the {{{textleft}}}, {{{textright}}}, {{{alignleft}}} and
 {{{alignright}}} classes.

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


More information about the wp-trac mailing list