From 2bfe9c548b2faa7bd53d192b8821eba20c24873e Mon Sep 17 00:00:00 2001 From: westi Date: Tue, 8 Dec 2009 12:45:32 +0000 Subject: [PATCH] Make the gallery shortcode float the right way for RTL languages. Fixes #7134 props ikonst. git-svn-id: http://svn.automattic.com/wordpress/trunk@12338 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/media.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index ab8d521c9..f0b5f2404 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -648,7 +648,7 @@ add_shortcode('gallery', 'gallery_shortcode'); * @return string HTML content to display gallery. */ function gallery_shortcode($attr) { - global $post; + global $post, $wp_locale; static $instance = 0; $instance++; @@ -711,7 +711,8 @@ function gallery_shortcode($attr) { $captiontag = tag_escape($captiontag); $columns = intval($columns); $itemwidth = $columns > 0 ? floor(100/$columns) : 100; - + $float = $wp_locale->text_direction == 'rtl' ? 'right' : 'left'; + $selector = "gallery-{$instance}"; $output = apply_filters('gallery_style', " @@ -720,7 +721,7 @@ function gallery_shortcode($attr) { margin: auto; } #{$selector} .gallery-item { - float: left; + float: {$float}; margin-top: 10px; text-align: center; width: {$itemwidth}%; }