diff --git a/functions.php b/functions.php index 0f5b9f7..671eb1e 100644 --- a/functions.php +++ b/functions.php @@ -10,6 +10,7 @@ require_once locate_template('/lib/config.php'); // Configuration require_once locate_template('/lib/activation.php'); // Theme activation require_once locate_template('/lib/cleanup.php'); // Cleanup require_once locate_template('/lib/nav.php'); // Custom nav modifications +require_once locate_template('/lib/gallery.php'); // Custom [gallery] modifications require_once locate_template('/lib/comments.php'); // Custom comments modifications require_once locate_template('/lib/rewrites.php'); // URL rewriting for assets require_once locate_template('/lib/relative-urls.php'); // Root relative URLs diff --git a/lib/cleanup.php b/lib/cleanup.php index 0b16711..9594fc2 100644 --- a/lib/cleanup.php +++ b/lib/cleanup.php @@ -186,106 +186,6 @@ function roots_caption($output, $attr, $content) { } add_filter('img_caption_shortcode', 'roots_caption', 10, 3); -/** - * Clean up gallery_shortcode() - * - * Re-create the [gallery] shortcode and use thumbnails styling from Bootstrap - * - * @link http://twitter.github.com/bootstrap/components.html#thumbnails - */ -function roots_gallery($attr) { - $post = get_post(); - - static $instance = 0; - $instance++; - - if (!empty($attr['ids'])) { - if (empty($attr['orderby'])) { - $attr['orderby'] = 'post__in'; - } - $attr['include'] = $attr['ids']; - } - - $output = apply_filters('post_gallery', '', $attr); - - if ($output != '') { - return $output; - } - - if (isset($attr['orderby'])) { - $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); - if (!$attr['orderby']) { - unset($attr['orderby']); - } - } - - extract(shortcode_atts(array( - 'order' => 'ASC', - 'orderby' => 'menu_order ID', - 'id' => $post->ID, - 'itemtag' => '', - 'icontag' => '', - 'captiontag' => '', - 'columns' => 3, - 'size' => 'thumbnail', - 'include' => '', - 'exclude' => '', - 'link' => 'file' - ), $attr)); - - $id = intval($id); - - if ($order === 'RAND') { - $orderby = 'none'; - } - - if (!empty($include)) { - $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); - - $attachments = array(); - foreach ($_attachments as $key => $val) { - $attachments[$val->ID] = $_attachments[$key]; - } - } elseif (!empty($exclude)) { - $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); - } else { - $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); - } - - if (empty($attachments)) { - return ''; - } - - if (is_feed()) { - $output = "\n"; - foreach ($attachments as $att_id => $attachment) { - $output .= wp_get_attachment_link($att_id, $size, true) . "\n"; - } - return $output; - } - - $output = '