diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index a5291f1e8..db3778057 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -97,6 +97,14 @@ function fix_attachment_links($post_ID) { continue; $id = $id_matches[2]; + + // While we have the attachment ID, let's adopt any orphans. + $attachment = & get_post($id); + if ( ! is_object(get_post($attachment->post_parent)) ) { + $attachment->post_parent = $post_ID; + wp_update_post($attachment); + } + $post_search[$i] = $anchor; $post_replace[$i] = preg_replace("#href=(\"|')[^'\"]*\\1#e", "stripslashes('href=\\1').get_attachment_link($id).stripslashes('\\1')", $anchor); ++$i; diff --git a/wp-admin/inline-uploading.php b/wp-admin/inline-uploading.php index 680ec8871..682797f82 100644 --- a/wp-admin/inline-uploading.php +++ b/wp-admin/inline-uploading.php @@ -158,6 +158,7 @@ if ( count($attachments) > 0 ) { $__not_linked = __('Not Linked'); $__linked_to_page = __('Linked to Page'); $__linked_to_image = __('Linked to Image'); + $__linked_to_file = __('Linked to File'); $__using_thumbnail = __('Using Thumbnail'); $__using_original = __('Using Original'); $__no_thumbnail = __('No Thumbnail'); @@ -167,11 +168,13 @@ if ( count($attachments) > 0 ) { $script .= "notlinked = '$__not_linked'; linkedtoimage = '$__linked_to_image'; linkedtopage = '$__linked_to_page'; +linkedtofile = '$__linked_to_file'; usingthumbnail = '$__using_thumbnail'; usingoriginal = '$__using_original'; "; foreach ( $attachments as $key => $attachment ) { $ID = $attachment['ID']; + $href = get_attachment_link($ID); $meta = get_post_meta($ID, '_wp_attachment_metadata', true); if (!is_array($meta)) { $meta = get_post_meta($ID, 'imagedata', true); // Try 1.6 Alpha meta key @@ -204,7 +207,6 @@ src{$ID}b = '{$image['guid']}'; $xpadding = (128 - $image['uwidth']) / 2; $ypadding = (96 - $image['uheight']) / 2; $style .= "#target{$ID} img { padding: {$ypadding}px {$xpadding}px; }\n"; - $href = get_attachment_link($ID); $script .= "a{$ID}a = ''; a{$ID}b = ''; img{$ID}a = '\"{$image['post_title']}\"'; @@ -222,9 +224,13 @@ img{$ID}b = '\"{$image['post "; } else { + $script .= "a{$ID}a = '{$attachment['post_title']}'; +a{$ID}b = '{$attachment['post_title']}'; +"; $html .= "
@@ -299,6 +305,17 @@ function toggleLink(n) { ol.innerHTML = notlinked; } } +function toggleOtherLink(n) { + od=document.getElementById('div'+n); + ol=document.getElementById('L'+n); + if ( ol.innerHTML == linkedtofile ) { + od.innerHTML = eval('a'+n+'a'); + ol.innerHTML = linkedtopage; + } else { + od.innerHTML = eval('a'+n+'b'); + ol.innerHTML = linkedtofile; + } +} function toggleImage(n) { o = document.getElementById('image'+n); oi = document.getElementById('I'+n); diff --git a/wp-content/themes/default/attachment.php b/wp-content/themes/default/attachment.php new file mode 100644 index 000000000..6a31a61f2 --- /dev/null +++ b/wp-content/themes/default/attachment.php @@ -0,0 +1,79 @@ + + +
+ + + + +
+

post_parent); ?> »

+
+post_mime_type); + switch ( $type[0] ) { + case 'image' : + $meta = get_post_meta($post->ID, '_wp_attachment_metadata', true); + if ($meta['width'] > 450) : ?> +

<?php the_title(); ?>

+ +

<?php the_title(); ?>

+ +

guid); ?>

+ + Read the rest of this entry »

'); ?> + + Pages: ', '

', 'number'); ?> + + + +
+
+ + + + + +

Sorry, no attachments matched your criteria.

+ + + +
+ +