-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add ltr.css support for RTL-based multilingual sites #10476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
### Summary Adds support for loading `ltr.css` in RTL-based multilingual WordPress sites, mirroring the existing `rtl.css` behavior. ### Details - Introduces `wp_style_add_data( $handle, 'ltr', 'replace' )` and `'suffix'` modes - Uses `extra['ltr']` and `_css_href()` for consistent file resolution - Applies `style_loader_tag` filter for extensibility - Ensures compatibility with single-file enqueue behavior in WordPress Core ### Trac Ticket See: https://core.trac.wordpress.org/ticket/64193
remove trailing whitespace on line 274
…ering. Props @asadister. See #64193
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Replaced short array syntax `[]` with `array()` to meet WordPress Coding Standards.
Adds unit tests verifying LTR stylesheet support in wp_register_style() and wp_print_styles(). - Confirms that `wp_style_add_data()` correctly stores 'ltr' data (replace/suffix modes). - Ensures LTR stylesheets are printed after their main styles in HTML output. - Covers both RTL and LTR locale cases. - Marks `print_emoji_styles` as expected deprecated to prevent false failures. Props asadister. See [#64193](https://core.trac.wordpress.org/ticket/64193).
…rint_styles(). Implements comprehensive PHPUnit tests for verifying LTR stylesheet support. These tests cover: - Proper registration of LTR data using `wp_style_add_data()`. - Behavior differences between LTR and RTL locales. - Ensuring that LTR variants are correctly printed in HTML output via `wp_print_styles()`. - Verification of stylesheet order to confirm that the LTR stylesheet appears after its main counterpart. Includes handling for the deprecation of `print_emoji_styles` to ensure compatibility with WordPress 6.4+. Props asadister. See [#64193](https://core.trac.wordpress.org/ticket/64193).
Adds support for loading
ltr.cssandstyle-ltr.cssin RTL-based multilingual WordPress sites, mirroring the existingrtl.cssandstyle-rtl.cssbehavior.This enhancement enables WordPress to automatically detect and load an
ltr.cssfile when available, ensuring proper layout and direction handling for left-to-right content within otherwise RTL environments.Details:
wp_style_add_data( $handle, 'ltr', 'replace' )and'suffix'modesextra['ltr']and_css_href()for consistent file resolutionstyle_loader_tagfilter for extensibilityIncludes:
Props asadister.
Trac ticket: https://core.trac.wordpress.org/ticket/64193
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.