• Resolved pobermarck

    (@pobermarck)


    Hello,

    I’m still trying to sort things out on my website and would like to sort my photos by date originally created. Unfortunately since I am using the Media Library and the photos are being created anew, they are all dated 2023. So I need a way to edit the PhotoID or the Creation Date but I cannot figure out how.

    I am currently using the title box for the Title, Media and Date of the piece, so I cannot sort by title.

    So can I alter the photo id, and how?

    The shortcode reads:

    [gallery ids='1993,1992,1991,1984,1983,1982,1981,1980,1978,1977,1975,1973,1971,1970,1966,1965,1964,1962,1961,1960,
    1955,1953,1952,91,90,89,94,88,18,19,2157,2153,2152,2150,2085,2451,2448,2450,2436,2430,2443,2442,2439,2432,2427,2423,
    2422,2426,2407,2406,2421,2419,2418,2417,2414,2408,2411,2412,2336' order='ASC' orderby='post_date' count='1000' main_size='full' tile_size='full' style='mosaic' type='wp']

    so I assume those are the ids I need to change?

    Thanks!

    Philip

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Sayontan Sinha

    (@sayontan)

    This is more of a core WordPress question rather than a Photonic question, so I had to run a Google search for this.

    This is what I found: https://stackoverflow.com/questions/53991741/how-to-change-media-file-upload-date-in-wordpress. I see that the sort order is by post_date, so you could consider creating a post with an older publication date, then attach your media to that post. That way, when you pull the id for the attachment it could get an older creation date.

    Thread Starter pobermarck

    (@pobermarck)

    Thank you. I figured these were values that Photonic pulled from WP or the photo metadata somehow. I’ll look into that Stackoverflow article.

    Plugin Author Sayontan Sinha

    (@sayontan)

    You are right – Photonic pulls metadata from the photos (technically, it is the metadata that WP stores, not things directly on the photos). However, Photonic cannot modify the metadata on the photos. In other words, if you were looking to change a post id or a post date, that would be handled directly within WP.

    Thread Starter pobermarck

    (@pobermarck)

    Still working on this. I have attached my images in my media library to different pages that I have modified the dates for, changing the year to 2007, 2008, 2009, etc. Unfortunately this doesn’t seem to have solved the sort by creation date issue.

    I have set up a test page with 1 image from each year to try different settings on.

    do you have any other suggestions? I suppose I could change image names or titles, but that seems like a workaround rather than a fix.

    Thread Starter pobermarck

    (@pobermarck)

    Looks like the most straightforward way to arrange things the way I want will be to rename all my photos to start with a date. Assigning them to a post with an altered date did not work, but I’m not sure why.

    Plugin Author Sayontan Sinha

    (@sayontan)

    I can try out a few things here, but unfortunately I am fully booked with other activities for the next few days. Hopefully early next week I might have other suggestions.

    Thread Starter pobermarck

    (@pobermarck)

    That’s fine. I’m not in a hurry, and frankly, I’ve not found another gallery/lightbox plugin that I like better.

    Thread Starter pobermarck

    (@pobermarck)

    Any update? I’ve tried naming my images YYYY-MM-Image.jpg and sorting by name, but for some reason that doesn’t work for all images.

    I’m working locally now since I ran into the dreaded white screen, but plan on getting the current version installed online this weekend.

    Plugin Author Sayontan Sinha

    (@sayontan)

    I will have some cycles to look into this on Sunday.

    Plugin Author Sayontan Sinha

    (@sayontan)

    I was finally able to look into this today. You have some options, but they are cumbersome.

    Basically, default WP lets you create galleries 2 ways:

    1. By directly uploading images when you are creating a post. In such a case, the gallery is referenced by the post’s id rather than the images’ ids. E.g. your gallery shortcode would say, [gallery id='1234'], where id is your post’s id. You could even reference a different post here.
    2. By selecting images that you want to attach to the specific post, assuming that you have already uploaded them to your media library. In such a case, your gallery shortcode would say, [gallery ids='1,2,3,4'], where each of the values in the ids refers to an individual image (and not a post).

    The first option lets you do a sorting. You could basically pass an orderby attribute and use any of the attributes listed on this page. The ones of interest to you would be the date or modified or title options.

    The second option does not let you use the orderby attribute at all. However, what it does is, it respects the order of the photos that you have provided. You can manually rearrange the photos the way you wish using the WordPress Gallery UI, and the gallery will respect that order.

    Now, when it comes to Photonic, Photonic offers 5 options:

    • Sequence in which they are provided (this would apply to option 2 above)
    • Title of the image in the media library (option 1)
    • Creation date (option 1)
    • Random order (option 1)
    • Photo ID (option 1)

    There are 2 problems in Photonic with the above:

    1. The above layout is bad. I should be filtering out the list to only show relevant options to you. So, if you have selected image ids, I should only show the first item from the list.
    2. Photonic seems to bypass the screen of WP galleries that lets you reorder photos. So, though there is an option in Photonic that says “Sequence in which they are provided”, there is nothing within Photonic to let you specify that sequence.

    I will need to fix these issues.

    In the interim, there is a workaround. I assume you are using the Block Editor (Gutenberg). You can create a WP gallery (not a Photonic gallery) and order it the way you need to – regardless of the name, creation date etc., you can set the sequency you desire. You can then use the option to “Transform” the standard WP gallery block to a Photonic block… and use Photonic’s features after that.

    Alternatively, if you are not using the Block Editor and are instead using a shortcode, then the fix is even easier. When you create a standard gallery, order it with your desired sequence, and it will generate a shortcode of this format:

    [gallery ids='3,2,1,4,5']

    You can simply add an additional parameter to it to convert it to a Photonic gallery:

    [gallery ids='3,2,1,4,5' style='square']

    The style parameter will convert this to a Photonic gallery. Depending on what type of layout you have, you can use square or random (for a justified grid) or masonry (for a masonry layout).

    Thread Starter pobermarck

    (@pobermarck)

    Thanks so much for this information. I will try it this way. I really appreciate your help with this issue.

    Thread Starter pobermarck

    (@pobermarck)

    It looks like that works! I’m using a block editor so I just create my WP Gallery, order the images how I want and then convert that gallery to a Photonic Gallery. Thanks again!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Sorting Photos from the WP Media Library’ is closed to new replies.