Closed ghost closed 12 years ago
I don't understand the problem being fixed here...
The default WordPress gallery shortcode automatically calculates gallery column width based on the number of gallery items. The original script sets the number of columns to 9999, which calculates to each column receiving 0% width. This stacks all the images on top of each other, as shown in this screenshot http://dl.dropbox.com/u/2444329/gallery-type-screenshot.png. By changing the [gallery]
columns value to something more reasonable, like 6, the widths are calculated more reasonably, like so: http://dl.dropbox.com/u/2444329/gallery-type-screenshot-2.png. The accompanying CSS simply changes the IMG widths to fluid, percentage-based values so that they don't spill outside of the gallery images box on smaller displays.
All that aside, as I commented on the Pull Request, it would be better to do something that's shortcode agnostic, like this:
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts( $args );
if ( $attachments ) {
echo '<ul class="attachments">';
foreach ( $attachments as $attachment ) {
echo '<li>'.wp_get_attachment_image( $attachment->ID, 'full' ).'</li>';
}
echo '</ul>';
}
Since this will allow complete control over HTML output, and won't be affected if theme developer has implemented their own [gallery]
shortcode.
Ah, I see. Thanks!
Hi
I added 4 images to a gallery post, WordPress version 3.3-beta2 Only 1 image shows in the GALLERY IMAGES preview area, and the gallery is not displayed on the front end. Am I missing something? thanks