There are a few different ways you could achieve this.
I recently did it as follows:
- Activate a simple plugin called 'Media Library Categories'. This lets you assign taxonomy terms to images. You can add a line to your functions.php telling it to create a new taxonomy so it's separate from your other categories.
- Create a category called 'Gallery'
- Then instead of inserting the images, you can simply check the 'Gallery' box on each one
- Insert some code in your template to query for the images and display them in a gallery. I use Wordpress's native gallery feature.
Here's a sample snippet from my code [note - you may want to edit the query/put some logic around it to make sure you get four images]:
$attachments = get_children( array(
'post_parent' => $post->ID ,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC',
'category_media' => 'gallery',
'orderby' => 'menu_order'
if ( !empty( $attachments ) ):
$gallery = implode(", ", array_keys($attachments));
echo do_shortcode("[gallery ids='".$gallery."']");
If the photos you want to put in the gallery are the only ones attached to the post, you could skip the plugin part and just output all attached images.
Hope this helps.