Hmmmm... I have over 300 albums using "iptcsublocation" as a custom sort. They are fine now but I would like to fix this as it is part of my work flow. Can you give me some instructions on how to code this?
A search of the forum for "admin_sortbyoptions" yields zero.
Actually it was meant that existing custom sort orders keep working, just no interface for setting new ones. At least that worked in our tests when we changed that… Ist that the case?
You will have to create a - actually rather simple - plugin to extend the fields list to sort by (the filter is new in 1.6 so you cannot find anything for it, we also have still to update our filter documentation). I will try to create a demo plugin for this - it's actually rather simple - but that may take some time.
Yes you are correct, images are still sorting according to "iptcsublocation", apparently due to restoring the DB. The image sort after upgrading to 1.6 is "Custom (webp)". If I change that option to manual and apply, the custom option disappears, unless I restore the DB. So the sort method appears to be persistent in the DB. But once changed it will be lost.
Hm, actually we try to keep already existing sortorder for albums to be kept. "webp" is a weird order of course… I don't remember that we set any default…
If I change that option to manual and apply, the custom option disappears, unless I restore the DB.
Yes, it disappears as soon as you change to anything else. It is only meant as a fallback.
"Manual" of course means ordering via drag&drop sorting and not by any specific db column. (Mention it just in case…)
You basically need a simple admin type plugin that does this (I have not tested if this works via a functions.php of a theme):
zp_register_filter('admin_sortbyoptions', 'yourcustomorder');
function yourcustomorder($orders, $type) {
// you want to sort the images within real albums
if ($type == 'images') {
$orders['Display name for selector'] = 'dbcolumn'; // technically here combinations that are valid sql are possible as before
}
return $orders;
}
As promised you find here a simple plugin template for this: https://github.com/zenphoto/DevTools/blob/master/plugins/admin_custom_sortorder.php
Please see the in-file comments how to modify.
Thanks so much Malte!! I missed seeing this till yesterday. I got it working fine. Just had to enter in my actual sort field.
$orders['IPTCSubLocation'] = 'IPTCSubLocation';
This works great for ZP users who use Lightroom, which can write a specific sequence to any EXIF or IPTC field using the LR/Transporter plugin from https://www.photographers-toolbox.com/. I chose IPTCSubLocation years ago bc it is a field that is rarely (if ever) written to by the camera.
So this transfers my custom sort used in LR to my website very efficiently. Both local and live sites are sorted custom, & exactly the same automatically.
Thanks for all your great work.
Will custom sort order be incorporated into 1.6xxx? Or will it be a plug-in? I am currently using this customized plug-in (below) from Malte on Github, but the latest development release does not contain the option in admin or as a plug-in.
https://github.com/zenphoto/DevTools/blob/master/plugins/admin_custom_sortorder.php
https://github.com/zenphoto/DevTools/blob/master/plugins/admin_custom_sortorder.php
Malte, you wrote this custom sort plug in a few years ago. It works on my local install but for some reason failed today on my live version. Both are running 1.6.6a. I can upgrade but have been holding off. Should this version be working fine with 1.6.6a forward or do i need to make some modifications?
The sort using the plugin is not using chosen field
**Tried on 1.6.8 cannot get to work.
Still works fine on 1.6.6a on local install