I’m not sure I 100% grasp what you’re trying to do, but I believe using WordPress’ default Gallery shortcode is what you want. When you insert an image into the content using the “Add Media” button, you can create a gallery and say how many columns you want the gallery to be.
If mark-up doesn’t line-up well you could always repurpose the shortcode with your own mark-up, by using remove_shortcode( 'gallery' );
and then coding up your own function and doing an add_shortcode( 'gallery', 'my_gallery_shortcode );
Related Posts:
- Separate Media Library for each user
- Maintaining image color and quality when uploading using custom sizes
- Saving the pre-sanitized filename of an attachment as the Title or Caption
- Bulk edit wordpress images alt and title attributes
- Upload Image Not accessible
- Alter media caption/description conflict in WordPress?
- Separate attachment images from post loop
- Loop through child images of a parent for a Nivo Slider
- Rename attachments during upload
- alt, title tags not showing
- Limit author image size
- Remove the http protocol from images
- Why can’t I edit certain images from the WordPress Media library?
- How to add a media with PHP
- How can I store an image in the database with Transients API?
- How to prevent resized featured images?
- Get original image from thumbnail URL
- Display one random image, but only if landscape
- WordPress url image redirect to the homepage
- How to change image url?
- Bulk image rotation
- Is there a way to delete images from WordPress media library programmatically?
- Special purpose photos with each post
- WordPress – different icon image depends of comment number
- Change image url size in post editor (when cliking on image)
- Multiple images with Media Uploader on front-end
- Pull Random Attachments With Pagination
- image uploaded cant be shown
- Turn off image captions in gallery view?
- How to get default image sizes attribute
- Unyson Framework doesn’t show gallery images
- add_shortcode to capture URL screenshot not loading correctly
- Broken Images until Page Refresh
- Show image crop window on image upload
- Gallery with thumbnail carousel
- Uploaded images not displaying in network site
- Correctly implementing the Facebook Like button
- Omit image captions from get_the_content()
- Specific image size is being generated without being registered
- How to limit the number of images displayed in the media window?
- Should I not compress my jpeg files before uploading to avoid double compression?
- Is it possible to preserve original images in order to change image size later?
- Generating a certain sized thumbnail on the fly?
- Need custom picture field for pages
- Only make custom image size if uploaded via Thickbox and attached to certain page
- Link listings with image
- Allow users to contribute images to a post
- How to add onclick event to widget image
- After Migration, images show up on a preview of the page but not the actual page [closed]
- Use default image as var
- How to apply image alt descriptions from media library?
- Specify automatically the height and weight of the images
- Image upload error?
- How to crop images in a certain size only for a certain page?
- How to pass on a value as parameter via url to another page
- Image not showing using a custom function and get_post_meta
- Random home page background images with caption text
- Cache issues with images not showing up
- Specific Days, Specific image on Front Page
- How to change image’s author via a function when using GravityForms uploader? [closed]
- Using different size thumbnails on different parts of my site… with functions.php?
- Serving Images from subdomain in wordpress
- Hover a css icon width other color inside wp_get_attachment_image
- Pictures randomly replaced by blue question mark
- WordPress PHP custom function is causing 500 Internal Server Error Connection Timeout
- Can’t upload Images to WordPress – Error 500 Response
- Post-processing of the image failed
- Get post thumbnail in specific size
- How to skip the creation of landscape thumbnails for an original portrait image
- Why are my button images blurry on mobile screens?
- Text not wrapping properly around image in WordPress Visual Editor [closed]
- How to show only one image in homepage
- Broken imges after moving wordpress website from localhost to server [closed]
- How to regularly backup and update WordPress website with lot of images?
- Resize images to match CSS
- Featured image appears in header
- Preventing the image-post problem from ahead (edit: without redirects)
- How to call thumbnail by aqua resizer in best practice. Specify image dimensions’s notify from GTmetrix
- WAMP install acts different than live install when uploading images
- Images Wont Display After Importing From Old WordPress
- How do i replace the title attribute of img tag with the image caption
- How can I hook and edit on the fly an image uploaded
- Anomaly with response coming from XML RPC Api get Post (integer out of range)
- Make all images displayed in single.php a certain size
- wp_get_attachment_image_src
- I am trying to get metabox image with custom size
- Removing image dimensions from `the_content`
- Theme files and imagesnot loading on a mobile device
- Guaranteed Image Sizes
- Is there a different way to grab a thumbnail image than this?
- Multiple gallery thumnbnails on one page
- Change image link in excerpt to point to post
- Putting the title attribute in image tag — Snapshot Theme from Woothemes
- Change the avatar ratio?
- get_theme_file_uri function not showing background image inside data-setbg in html
- How to show file type of featured image?
- WordPress Theme: replace logo image with title site if file doesn´t exist on server
- WordPress update leads to 404 error on admin page and signup. CSS mishap with all plugin related functions
- How to get dimension of Logo and Crest
- WordPress Missing Images