From 193b20c03fa5ef96578f2cbffda39c7bdf529d97 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 24 Mar 2008 02:57:19 +0000 Subject: [PATCH] Gallery display enhancements from tellyworth. fixes #6368 git-svn-id: http://svn.automattic.com/wordpress/trunk@7496 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/media.php | 8 +++---- wp-includes/media.php | 42 ++++++++++++++++++++++++++++++------- wp-includes/shortcodes.php | 1 + 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index e092a5c88e..bd52462392 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -460,10 +460,10 @@ function get_attachment_taxonomies($attachment) { function image_attachment_fields_to_edit($form_fields, $post) { if ( substr($post->post_mime_type, 0, 5) == 'image' ) { $form_fields['post_title']['required'] = true; - $form_fields['post_excerpt']['label'] = __('Description'); + $form_fields['post_excerpt']['label'] = __('Caption'); $form_fields['post_excerpt']['helps'][] = __('Alternate text, e.g. "The Mona Lisa"'); - $form_fields['post_content']['label'] = __('Long Description'); + $form_fields['post_content']['label'] = __('Description'); $thumb = wp_get_attachment_thumb_url($post->ID); @@ -554,11 +554,11 @@ function get_attachment_fields_to_edit($post, $errors = null) { 'value' => $edit_post->post_title, ), 'post_excerpt' => array( - 'label' => __('Description'), + 'label' => __('Caption'), 'value' => $edit_post->post_excerpt, ), 'post_content' => array( - 'label' => __('Long description'), + 'label' => __('Description'), 'value' => $edit_post->post_content, 'input' => 'textarea', ), diff --git a/wp-includes/media.php b/wp-includes/media.php index 07f290b017..dc47118796 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -339,8 +339,20 @@ function gallery_shortcode($attr) { $output = apply_filters('post_gallery', '', $attr); if ( $output != '' ) return $output; + + extract(shortcode_atts(array( + 'orderby' => 'menu_order ASC, ID ASC', + 'id' => $post->ID, + 'itemtag' => 'dl', + 'icontag' => 'dt', + 'captiontag' => 'dd', + 'columns' => 3, + 'size' => 'thumbnail', + ), $attr)); - $attachments = get_children("post_parent=$post->ID&post_type=attachment&post_mime_type=image&orderby=\"menu_order ASC, ID ASC\""); + $id = intval($id); + $orderby = addslashes($orderby); + $attachments = get_children("post_parent=$id&post_type=attachment&post_mime_type=image&orderby=\"{$orderby}\""); if ( empty($attachments) ) return ''; @@ -348,16 +360,21 @@ function gallery_shortcode($attr) { if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $id => $attachment ) - $output .= wp_get_attachment_link($id, 'thumbnail', true) . "\n"; + $output .= wp_get_attachment_link($id, $size, true) . "\n"; return $output; } + $listtag = tag_escape($listtag); + $itemtag = tag_escape($itemtag); + $captiontag = tag_escape($captiontag); + $columns = intval($columns); + $output = apply_filters('gallery_style', "