Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added CSS RTL Support. #4

Closed
wants to merge 1 commit into from

2 participants

@KingYes

Hey justintadlock,
I just add new support for RTL support..

Thanks you for your good code. :)

Yakir.

@KingYes KingYes referenced this pull request
Closed

Add RTL Support.. #3

@justintadlock

I'm thinking about taking this a different direction and using the WordPress-generated "rtl" body class. It'll simplify the code and we won't need any additional files or PHP.

@KingYes

No Problem.

@justintadlock

8d1e743

I just committed a first-pass on RTL styles on the 0.2 branch. I don't really have a testing environment set up for this. Whenever you get a chance, let me know if it works for you.

Also, this code assumes that your WordPress theme correctly uses the body_class() function (most do).

@justintadlock

I'm marking this as resolved. Everything seems to be in order in my tests. If anyone runs into any issues with it, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 24, 2012
  1. @KingYes

    Added CSS RTL Support.

    KingYes authored
This page is out of date. Refresh to see the latest.
Showing with 73 additions and 0 deletions.
  1. +63 −0 css/columns-rtl.css
  2. +10 −0 grid-columns.php
View
63 css/columns-rtl.css
@@ -0,0 +1,63 @@
+/**
+* CSS (RTL) for handling the [column] shortcode styles.
+*
+* @version 20121024
+* @author Yakir Sitbon (http://www.yakirs.net/)
+* @copyright Copyright (c) 2012, Justin Tadlock
+* @link http://justintadlock.com
+* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+*/
+
+.column-grid .column {
+ float: right;
+ margin-left: 5%;
+ margin-right: 0;
+}
+.column-grid .column-first {
+ margin-right: 0;
+ margin-left: auto;
+}
+.column-grid .column-last {
+ float: left;
+}
+
+/* === 2 columns === */
+
+/* $x = 52.5 */
+.column-grid-2 .column-push-1 { margin-right: 52.5%; margin-left: auto; }
+
+/* === 3 columns === */
+
+/* $x = 35 */
+.column-grid-3 .column-push-2 { margin-right: 70%; margin-left: auto; }
+.column-grid-3 .column-push-1 { margin-right: 35%; margin-left: auto; }
+
+/* === 4 columns === */
+
+/* $x = 26.25 */
+.column-grid-4 .column-push-3 { margin-right: 78.75%; margin-left: auto; }
+.column-grid-4 .column-push-2 { margin-right: 52.5%; margin-left: auto; }
+.column-grid-4 .column-push-1 { margin-right: 26.25%; margin-left: auto; }
+
+/* === 5 columns === */
+
+/* $x = 21 */
+.column-grid-5 .column-push-4 { margin-right: 84%; margin-left: auto; }
+.column-grid-5 .column-push-3 { margin-right: 63%; margin-left: auto; }
+.column-grid-5 .column-push-2 { margin-right: 42%; margin-left: auto; }
+.column-grid-5 .column-push-1 { margin-right: 21%; margin-left: auto; }
+
+/* === 12 columns === */
+
+/* $x = 8.75 */
+.column-grid-12 .column-push-11 { margin-right: 96.25%; margin-left: auto; }
+.column-grid-12 .column-push-10 { margin-right: 87.5%; margin-left: auto; }
+.column-grid-12 .column-push-9 { margin-right: 78.75%; margin-left: auto; }
+.column-grid-12 .column-push-8 { margin-right: 69%; margin-left: auto; }
+.column-grid-12 .column-push-7 { margin-right: 61.25%; margin-left: auto; }
+.column-grid-12 .column-push-6 { margin-right: 52.5%; margin-left: auto; }
+.column-grid-12 .column-push-5 { margin-right: 43.75%; margin-left: auto; }
+.column-grid-12 .column-push-4 { margin-right: 35%; margin-left: auto; }
+.column-grid-12 .column-push-3 { margin-right: 26.25%; margin-left: auto; }
+.column-grid-12 .column-push-2 { margin-right: 17.5%; margin-left: auto; }
+.column-grid-12 .column-push-1 { margin-right: 8.75%; margin-left: auto; }
View
10 grid-columns.php
@@ -128,6 +128,16 @@ public function enqueue_styles() {
null,
'20121007'
);
+
+ /* Enqueue the rtl stylesheet. */
+ if ( is_rtl() ) {
+ wp_enqueue_style(
+ 'grid-columns-rtl',
+ trailingslashit( plugin_dir_url( __FILE__ ) ) . "css/columns-rtl.css", // .min rtl stylesheet wiil be add soon.
+ array( 'grid-columns' ),
+ '20121024'
+ );
+ }
}
/**
Something went wrong with that request. Please try again.