After some research, I came up with a solution that worked for me.
It’s nice because it’s not using the WP Gallery (you don’t need to insert a gallery into your post/page to make it work).
It’s awesome because you can do whatever you want inside the “images loop”.
Note: the ‘preview’ in $size="preview"
is a custom size I created using add_image_size( 'preview', 120, 120, true );
inside my functions.php file.
And here’s what I came up with:
(... inside a new page.php ...)
<?php do_atomic( 'open_content' ); ?>
<?php $imgs_args = array(
'numberposts' => -1,
'order' => 'DESC',
'post_mime_type'=> 'image',
'post_type' => 'attachment',
'post_parent' => $post->ID,
); $imgs = get_children( $imgs_args ); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
(...)
<?php the_content(); ?>
<?php if( $imgs ) : ?>
<div class="showcase">
<?php foreach( $imgs as $img ) : ?>
<?php /* Setting Sizes */
$preview_size = wp_get_attachment_image_src( $img->ID, $size="preview" );
$full_size = wp_get_attachment_image_src( $img->ID, $size="full-size" ); ?>
<a href="https://wordpress.stackexchange.com/questions/84240/<?php echo $full_size[0]; ?>" rel="shadowbox" alt="<?php echo $img->post_title; ?>">
<img src="<?php echo $preview_size[0]; ?>" alt="<?php echo $img->post_title; ?>" />
</a>
<?php endforeach; ?>
</div>
<?php endif; ?>
(...)
It’s also worth mentioning that Justin Tadlock has a really nice plugin called Cleaner Gallery. It was while checking his plugin’ code that I found out about the nice get_children(); function that makes all this customization possible.
Hope it helps someone else in the future.