From 261fb43776d8bdad7275d2e23d0e55e49cba2109 Mon Sep 17 00:00:00 2001 From: Joel Kuzmarski Date: Fri, 20 Dec 2013 06:47:52 -0600 Subject: [PATCH] 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"] --- lib/gallery.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/gallery.php b/lib/gallery.php index 3bc6b64..67f4d01 100644 --- a/lib/gallery.php +++ b/lib/gallery.php @@ -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) ? '