From 009fe3e343101dfd427d5f5835f93f311d77c27d Mon Sep 17 00:00:00 2001 From: Peter Westwood 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: https://develop.svn.wordpress.org/trunk@12338 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 ab8d521c91..f0b5f2404b 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}%; }