Image Gallery – Custom Order

We are using an image gallery field which has the option to sort the images into a custom order but cannot see how to output this same order within our custom template.

We are using get_posts to retrieve these images using custom $args, as this example which is currently sorting the attachments by title and ASC.

$args = array(
'order' => 'ASC',
'orderby' => 'title',
'post_type' => 'attachment',
'post_parent' => $post->ID,
'post_mime_type' => 'image',
'post_status' => null,
'exclude' => get_post_thumbnail_id(),
'numberposts' => -1,

The questions is how do we sort using the custom order from within the modified post ?

Thank you


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer