I’m having problems with the built in gallery as well. I have deactivated all plugins to no avail.
Before 2.7 I was not even able to insert the gallery into posts because the galler tab would be blank. Now I get all the option except that it does not display.
I have a solution to this problem;
in wp-includes/post-template.php replace the existing code for
Retrieve an attachment page link using an image or icon, if possible.
*
* @since 2.5.0
with this new code below:
/**
* Retrieve an attachment page link using an image or icon, if possible.
*
* @since 2.5.0
* @uses apply_filters() Calls 'wp_get_attachment_link' filter on HTML content with same parameters as function.
*
* @param int $id Optional. Post ID.
* @param string $size Optional. Image size.
* @param bool $permalink Optional, default is false. Whether to add permalink to image.
* @param bool $icon Optional, default is false. Whether to include icon.
* @return string HTML content.
*/
function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false) {
$id = intval($id);
$_post = & get_post( $id );
if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
return __('Missing Attachment');
if ( $permalink )
$url = get_attachment_link($_post->ID);
$post_title = attribute_escape($_post->post_title);
$link_text = wp_get_attachment_image($id, $size, $icon);
//modification introduced to force the gallery shortcode thumbnail hyperlink to the full size image directly, rather than the attachment page
$url = wp_get_attachment_url($_post->ID);
if ( !$link_text )
$link_text = $_post->post_title;
return apply_filters( 'wp_get_attachment_link',"<a href="$url" title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon );
}
This corrected the gallery shortcode problem. Backup your original post-template.php before replacing this block of code.
Thanks to Mark Pedereson for the help on this.
R
I tried this and my blog just shows a blank page.
If this page is blank, than there is a typo.
function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false) {
$id = intval($id);
$_post = & get_post( $id );
if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
return __('Missing Attachment');
if ( $permalink )
$url = get_attachment_link($_post->ID);
$post_title = attribute_escape($_post->post_title);
$link_text = wp_get_attachment_image($id, $size, $icon);
//modification introduced to force the gallery shortcode thumbnail hyperlink to the full size image directly, rather than the attachment page
$url = wp_get_attachment_url($_post->ID);
if ( !$link_text )
$link_text = $_post->post_title;
return apply_filters( 'wp_get_attachment_link',"<a href=$url title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon );
}
I accidently pasted old version of the code. This is the updated version that corrected the problem.
R
@rhayashida,
Thank you so much for trying to help with this. I made the change and now I don’t get the blank page. I get the normal look and field of the posts except that the ‘gallery’ is still not working.
I’ve even deactivated all my plugins…
Okay, after trying many different things with my current blog and not having any luck I decided to create a new blog for testing.
I think I have found that the culprit here is my webhosting services (Yahoo Small Business). I even created this blog under a different account…
I created a new blog and I updated it to 2.7, disabled all plugins and still no luck! I will try to contact tech support with this new info and see where it gets me!
Interesting, because I have the same problem – Gallery not working at all no matter what short code I use – and I am also on Yahoo! hosting. What the heck are they doing that would stop this small thing from working? I am going to try the same blog on my GoDaddy account and see if I have more success. This sucks!
π
Low and behold the same exact plugin works fine on my GoDaddy account, but gives me nothing when installed on a blog that resides on Yahoo! Kinda weird, if you ask me, but I have found numerous anomalies like this while working between the two hosting companies – where certain things function on one and not on the other.