Make WordPress Core

Opened 10 years ago

Last modified 5 years ago

#28122 new enhancement

Themes - RTL: add support for fully mirrored css files

Reported by: yoavf's profile yoavf Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: rtl Cc:

Description

RTL support in themes is achieved through the creation of an rtl.css file, which is loaded (if it exists) in addition to the main theme css file. The rtl.css file should overwrite only those css properties from the main file that affect the horizontal layout.

The creation of an rtl.css file is mostly a manual process, and keeping it up to date with the main theme style.css file is a difficult task.

I propose that WordPress support loading of fully mirrored css files instead of the original theme css file, in a similar way to what was done for core/wp-admin css files in #24977.

How will this work?

  • Backwards compatibility: If an rtl.css file is found in the theme root, it will be loaded as usual (in addition to style.css).

Otherwise

  • Load ./rtl/style-rtl.css if it exists instead of style.css
  • For any additional css file in the theme folder enqueued using wp_enqueue_style (i.e. css/grid.css), look for a filename-rtl.css file in an rtl subdirectory (i.e css/rtl/grid-rtl.css) and load it if it exists instead of the original file.

While theme developers will be able to chose their tool of choice to create an rtl css file, we'll make it easier for them by updating grunt-cssjanus to work when run in a theme directory.

Change History (3)

#1 follow-up: @obenland
10 years ago

What about adding a grunt task that would create the rtl.css file?

#2 in reply to: ↑ 1 @ramiy
10 years ago

Another approach for that problem:

Each plugin has "admin" interface where the plugin author can do stuff like "Generate POT file" and "Add Domain to Gettext Calls" (https://wordpress.org/plugins/akismet/admin/).

Well, i was thinking why not allow theme author to do things like "Generating rtl.css file" throw the theme "admin" interface (https://wordpress.org/themes/twentyfourteen/admin/).

I am not talking about the "how", i am talking about the "where".

#3 @nivijah
9 years ago

I think the biggest issue to tackle here is how to decide what will and will not be mirrored.
Maybe a theme author could "flag" a css file to be mirrored and only those files would be converted ?

Note: See TracTickets for help on using tickets.