';
$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);
-
- $output .= '
' . $image;
+ $output .= ($i % $columns == 0) ? '': '';
+ $output .= '
' . $image;
+
if (trim($attachment->post_excerpt)) {
$output .= '
' . wptexturize($attachment->post_excerpt) . '
';
}
- $output .= '';
+
+ $output .= '
';
+ $i++;
+ $output .= ($i % $columns == 0) ? '
' : '';
}
-
- $output .= '';
+
+ $output .= ($i % $columns != 0 ) ? ' ' : '';
+ $output .= '';
return $output;
}
if (current_theme_supports('bootstrap-gallery')) {
remove_shortcode('gallery');
add_shortcode('gallery', 'roots_gallery');
+ add_filter('use_default_gallery_style', '__return_null');
}
+
+/**
+ * Add class="thumbnail img-thumbnail" to attachment items
+ */
+function roots_attachment_link_class($html) {
+ $postid = get_the_ID();
+ $html = str_replace('