Created
January 14, 2021 01:57
-
-
Save wplit/ea135f6fff317e074a15d0f2a43556a8 to your computer and use it in GitHub Desktop.
code-block for custom acf gallery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $images = get_field('my_gallery'); | |
| $size = 'large'; | |
| if( $images ): ?> | |
| <ul class="cell-container"> | |
| <?php foreach( $images as $image ): ?> | |
| <li class="cell"> | |
| <div class="cell-inner"> | |
| <img src="<?php echo esc_url($image['sizes'][$size]); ?>" alt="<?php echo esc_attr($image['alt']); ?>" /> | |
| <p class="caption"><?php echo esc_html($image['caption']); ?></p> | |
| </div> | |
| </li> | |
| <?php endforeach; ?> | |
| </ul> | |
| <?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment