Hello.
This wonderful slice of code numerically sorts Masonry Gallery images by ‘Title’ :
function avia_change_posts_query($query, $params){
if(!empty($query[‘orderby’]) && $query[‘orderby’] == ‘post__in’){
$query[‘order’] = ‘ASC’;
$query[‘orderby’] = ‘title’;
}
return $query;
}
add_filter(‘avia_masonry_entries_query’, ‘avia_change_posts_query’, 10, 2);
Is it possible that code can sort by Caption rather that Title – I have, predictably, tried to exchange title for excerpt / caption and so forth with no joy so far …
Is it important for you that the image title has a specific Value?
My Question: What if the titel is identical to your caption?
Thanks for your help and support Guenni007 – it is appreciated.
I actually tried Nextgen gallery a little earlier today and that – after some fiddling – allowed to order by excerpt numerically.
So I think, I’m away with it!
Hi joefraser,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
Victoria