• I am new to WordPress, but have been a Joomla developer for some time. I am working on a site which uses Google Photos as the backend and noted that Photonic doesn’t support sorting by Album title.

    As this was a major limitation for me I examined the code and I think I have found a simple solution to this. Obviously if I change the code, it will be overwritten on update, so I wondered if it could be considered for a future release?

    Basically it just sorts the object which is built up from the Google Photo calls on Title, before it is displayed.

    It is a one line change to a single file which works fine for me, but obviously I don’t know if there would be any knock on effects.

    The file is: wp-content/plugins/photonic/Modules/Google-Photos.php

    In function build_level_2_objects, right at the very end before it returns $objects(around line 640). add the following line:

    usort($objects, function($a, $b) {return strcmp($a->title, $b->title);});
    return $objects;
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Sayontan Sinha

    (@sayontan)

    I have explained why I don’t do this in several other threads: this only sorts the current returned dataset. If you have more than 50 albums or 100 photos, this will only sort the current page. E.g. if you Google returns albums P, Q and R in the first 50, and A, B and C in the next 50 (when you use the more feature in Photonic), the content of your display is still going to be scrambled because P, Q and R will show up before A, B and C.

    As I have suggested to others, your best recourse is to put in a feature request with Google. All other providers support sorting.

    Thread Starter ravenswoodit

    (@ravenswoodit)

    I appreciate the response, my thinking is that adding the sort doesn’t make matters any worse when using the more option, but if I choose to show all albums on one page, then it works great. I appreciate this may slow loading down a bit though.

    I will try to raise the issue with Google, but won’t hold my breath on them doing something soon.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Google Photos – sorting Albums by title’ is closed to new replies.