Fix gallery link option

Galleries should support three link types:

* Attachment Page (default): [gallery ids="1,2,3"]
* Media File: [gallery link="file" ids="1,2,3"]
* None: [gallery link="none" ids="1,2,3"]
This commit is contained in:
Joel Kuzmarski
2013-12-20 06:47:52 -06:00
parent c79e67ddcf
commit 261fb43776

View File

@@ -44,7 +44,7 @@ function roots_gallery($attr) {
'size' => 'thumbnail',
'include' => '',
'exclude' => '',
'link' => 'file'
'link' => ''
), $attr));
$id = intval($id);
@@ -85,7 +85,17 @@ function roots_gallery($attr) {
$i = 0;
foreach ($attachments as $id => $attachment) {
$image = ('file' == $link) ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
switch($link) {
case 'file':
$image = wp_get_attachment_link($id, $size, false, false);
break;
case 'none':
$image = wp_get_attachment_image($id, $size, false, array('class' => 'thumbnail img-thumbnail'));
break;
default:
$image = wp_get_attachment_link($id, $size, true, false);
break;
}
$output .= ($i % $columns == 0) ? '<div class="row gallery-row">': '';
$output .= '<div class="' . $grid .'">' . $image;