WordPress.org

Make WordPress Core

Ticket #24977: 24977.change_rtl_loading.2.diff

File 24977.change_rtl_loading.2.diff, 1.9 KB (added by yoavf, 7 years ago)

Refreshed - this takes care of loading rtl styles instead of ltr styles

  • src/wp-includes/class.wp-styles.php

     
    7171                        $end_cond = "<![endif]-->\n";
    7272                }
    7373
    74                 $tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle );
     74                $src_tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle );
     75
    7576                if ( 'rtl' === $this->text_direction && isset($obj->extra['rtl']) && $obj->extra['rtl'] ) {
    7677                        if ( is_bool( $obj->extra['rtl'] ) ) {
    7778                                $suffix = isset( $obj->extra['suffix'] ) ? $obj->extra['suffix'] : '';
     
    7980                        } else {
    8081                                $rtl_href = $this->_css_href( $obj->extra['rtl'], $ver, "$handle-rtl" );
    8182                        }
    82 
    83                         $tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle );
     83                        $src_tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-rtl-css' $title href='$rtl_href' type='text/css' media='$media' />\n", $handle );
    8484                }
    8585
     86                $tag .= $src_tag;
    8687                $tag .= $end_cond;
    8788
    8889                if ( $this->do_concat ) {
  • src/wp-admin/load-styles.php

     
    121121
    122122        if ( $rtl && isset($style->extra['rtl']) && $style->extra['rtl'] ) {
    123123                $rtl_path = is_bool($style->extra['rtl']) ? str_replace( '.min.css', '-rtl.min.css', $path ) : ABSPATH . $style->extra['rtl'];
    124                 $content .= get_file($rtl_path) . "\n";
     124                $content = get_file($rtl_path) . "\n";
    125125        }
    126126
    127127        if ( strpos( $style->src, '/wp-includes/css/' ) === 0 ) {