change default columns to 3.

Issue is if you set 3 in Gallery options it will output 4 columns in the frontend. The default WordPress column is 3 for gallery and if it's set to 3, it does not added any column attribute to the shortcode which cause the issue. Setting the default to 3 should fix the issue.
This commit is contained in:
Leo Gono
2015-03-03 15:26:50 +08:00
parent 9ee41494f7
commit 566563e701

View File

@@ -43,7 +43,7 @@ function gallery($attr) {
'itemtag' => '', 'itemtag' => '',
'icontag' => '', 'icontag' => '',
'captiontag' => '', 'captiontag' => '',
'columns' => 4, 'columns' => 3,
'size' => 'thumbnail', 'size' => 'thumbnail',
'include' => '', 'include' => '',
'exclude' => '', 'exclude' => '',
@@ -51,7 +51,7 @@ function gallery($attr) {
], $attr)); ], $attr));
$id = intval($id); $id = intval($id);
$columns = (12 % $columns == 0) ? $columns: 4; $columns = (12 % $columns == 0) ? $columns: 3;
$grid = sprintf('col-sm-%1$s col-lg-%1$s', 12/$columns); $grid = sprintf('col-sm-%1$s col-lg-%1$s', 12/$columns);
if ($order === 'RAND') { if ($order === 'RAND') {