Programatically re-order images in the ACF gallery add-on. Orderby Title, ID, etc
-
04-11-2019 - |
Question
I have a gallery field using the advanced custom fields gallery addon.
This is how I am outputting my gallery fields/images in my theme...
<?php
$images = get_field('gallery');
if( $images ): ?>
<div id="gallery-1">
<?php foreach( $images as $image ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php endforeach; ?>
</div>
<?php endif; ?>
And this is the only way in the documentation I can see how to implement it.
Does anyone now who how I can order the images by title, id or anything when they are outputted in the loop?
Many Thanks
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange