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
This commit is contained in:
parent
eae8a055c6
commit
2bfe9c548b
|
@ -648,7 +648,7 @@ add_shortcode('gallery', 'gallery_shortcode');
|
||||||
* @return string HTML content to display gallery.
|
* @return string HTML content to display gallery.
|
||||||
*/
|
*/
|
||||||
function gallery_shortcode($attr) {
|
function gallery_shortcode($attr) {
|
||||||
global $post;
|
global $post, $wp_locale;
|
||||||
|
|
||||||
static $instance = 0;
|
static $instance = 0;
|
||||||
$instance++;
|
$instance++;
|
||||||
|
@ -711,6 +711,7 @@ function gallery_shortcode($attr) {
|
||||||
$captiontag = tag_escape($captiontag);
|
$captiontag = tag_escape($captiontag);
|
||||||
$columns = intval($columns);
|
$columns = intval($columns);
|
||||||
$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
|
$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
|
||||||
|
$float = $wp_locale->text_direction == 'rtl' ? 'right' : 'left';
|
||||||
|
|
||||||
$selector = "gallery-{$instance}";
|
$selector = "gallery-{$instance}";
|
||||||
|
|
||||||
|
@ -720,7 +721,7 @@ function gallery_shortcode($attr) {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
#{$selector} .gallery-item {
|
#{$selector} .gallery-item {
|
||||||
float: left;
|
float: {$float};
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: {$itemwidth}%; }
|
width: {$itemwidth}%; }
|
||||||
|
|
Loading…
Reference in New Issue