Sort gallery by ID?

  • Author
  • #254662


    i wonder if there is a gallery code for sorting the image by id?

    the problem is that when i upload a file “name01, name02, name03” the name03 will come first and name 02 second and name01 will be in the end of the post, i want it to be like: name01, name02, name03.

    i am using this gallery shortcut: [gallery columns="1" size="medium"]



    There is an orderby option that you can use.

    It’s much easier to simply click on the Add an Image button and then change to the Gallery tab, where you can drag and drop the images to whatever order you want them to appear in the gallery.



    Hi! i know that i can drag and drop the images but its a pain when you have 40+ pics on at post, its takes just to much time to drag and drop images by id :)

    about the shortcut, i did a take a look at the gallery shortcut page but didnt understand what to write in the shortcut code :/ what should i write in this shortcut to have the images sorted by name? [gallery columns="1" size="medium"]



    Put orderby=”ID ASC” between the brackets.

    It appears that file name is ID, so if you want your photos in a different order, you’ll have to do it manually anyway.



    Try this:
    gallery columns="1" size="medium" sortby="ID DESC"]



    Let me clarify that ID one step further.

    ID is the name of the file when you upload it; not the title or caption you may give it after uploading.



    hmmm i tried both [gallery columns="1" size="medium" sortby="ID DESC"] and

    [gallery columns="1" size="medium" orderby="ID ASC"]

    but non of those shortcuts codes seems to work :/ the name1 pic is still at the end of the post while name45 pic is on top :(

    any other codes that i can try?



    Then orderby=”ID DESC” should do it.


    If not, how about orderby=”post_name ASC” ?



    dammit, both

    [gallery columns="1" size="medium" orderby="ID DESC"]


    [gallery columns="1" size="medium" orderby="post_name ASC"]

    didnt work. its still the same as before :/



    phattrance, are you talking about a blog you have here on wordpress.COM? I know that you were on COM at one point (and remember your question to me about the social bookmarking tool I’m using), but it looks like the current blog is a self-hosted WordPress install.



    i just moved to a .org blog but since the gallery shortcut is the same i asked here (cause the help here is WAAAAY better than the .org forum)

    anyway, i have tried different shortcuts and EVEN did the sorting by “order” box @ add media and it still did put the name5 pc on top and the name1 pic were at the end of the post..

    i found a way to make it alright but its stupid that i need to do it this way :) i just renamed the name05 pic to name01 and the image uploader will upload it backwards, lol



    The only trouble with asking here is that in general the software you are using is different than WordPress.COM users use, so your results may be different. Just sayin’…



    Same need and same problem than you Phattrance, see my post

    Hope the WP team will be able to fix it

The topic ‘Sort gallery by ID?’ is closed to new replies.