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
This commit is contained in:
Peter Westwood 2009-12-08 12:45:32 +00:00
parent 90521c0880
commit 009fe3e343
1 changed files with 4 additions and 3 deletions

View File

@ -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}%; }