Make WordPress Core

Ticket #43632: 43632.3.diff

File 43632.3.diff, 1.2 KB (added by audrasjb, 7 years ago)

In 43632.3.diff: replace unnecessary is_rtl() conditional tag with body_class CSS rule

  • src/wp-content/plugins/hello.php

    diff --git a/src/wp-content/plugins/hello.php b/src/wp-content/plugins/hello.php
    index 34e3b68..645b2a7 100644
    a b Dolly'll never go away again"; 
    5252// This just echoes the chosen line, we'll position it later
    5353function hello_dolly() {
    5454        $chosen = hello_dolly_get_lyric();
    55         echo "<p id='dolly'>$chosen</p>";
     55        echo "<p id='dolly'><span class='screen-reader-text'>Quote from Hello Dolly song</span><span aria-hidden='true'>&#9835;</span> $chosen</p>";
    5656}
    5757
    5858// Now we set that function up to execute when the admin_notices action is called
    add_action( 'admin_notices', 'hello_dolly' ); 
    6060
    6161// We need some CSS to position the paragraph
    6262function dolly_css() {
    63         // This makes sure that the positioning is also good for right-to-left languages
    64         $x = is_rtl() ? 'left' : 'right';
    65 
    6663        echo "
    6764        <style type='text/css'>
    6865        #dolly {
    69                 float: $x;
    70                 padding-$x: 15px;
    71                 padding-top: 5px;               
     66                float: right;
     67                padding: 6px 10px 4px 0;
    7268                margin: 0;
     69                line-height: 1.7;
    7370                font-size: 11px;
    7471        }
     72        body.rtl #dolly {
     73                float: left;
     74                padding: 6px 0 4px 10px;
     75        }
     76        @media screen and (max-width: 782px) {
     77                #dolly {
     78                        float: none;
     79                }               
     80        }
    7581        </style>
    7682        ";
    7783}