A lightweight extension of Advanced Custom Field (ACF) that adds Photo Gallery field to any post/pages on your WordPress website.
- Visually create your Fields
- Add multiple photos and you can also modify title, caption and link to anything
- Assign your fields to multiple edit pages (via custom location rules)
- Easily load data through a simple and friendly API
- Uses the native WordPress custom post type for ease of use and fast processing
- Uses the native WordPress metadata for ease of use and fast processing
Note
This plugin is alternative of ACF Gallery Pro. You need to have knowledge of coding because youll be required to edit your WordPress theme source code. If you are looking for shortcodes and prebuilt gallery then this plugin is NOT for you. This plugin will give you PHP array of images and youll need to make the gallery layout as you wish.
Usage
acf_photo_gallery is a helper function that takes in ACF_FIELD_NAME and POST_ID will query the database and compile the images for you. The output of this function will be an array.
acf_photo_gallery(ACF_FIELD_NAME, POST_ID);
Example
The following example is using Twitter Bootstrap framework to layout. You can use any framework of your choice.
`<?php //Get the images ids from the post_metadata $images = acf_photo_gallery('vacation_photos', $post->ID); //Check if return array has anything in it if( count($images) ): //Cool, we got some data so now let's loop over it foreach($images as $image): $id = $image['id']; // The attachment id of the media $title = $image['title']; //The title $caption= $image['caption']; //The caption $full_image_url= $image['full_image_url']; //Full size image url $full_image_url = acf_photo_gallery_resize_image($full_image_url, 262, 160); //Resized size to 262px width by 160px height image url $thumbnail_image_url= $image['thumbnail_image_url']; //Get the thumbnail size image url 150px by 150px $url= $image['url']; //Goto any link when clicked $target= $image['target']; //Open normal or new tab $alt = get_field('photo_gallery_alt', $id); //Get the alt which is a extra field (See below how to add extra fields) $class = get_field('photo_gallery_class', $id); //Get the class which is a extra field (See below how to add extra fields) ?>