We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!

Answered Gallery sortby?

    • 7527
    • 437 Posts
    Hi, I have the following call for a gallery of images:

    [[!getPage@newspaging?
    &element=`Gallery`
    &plugin=`slimbox` 
    &thumbTpl=`galItemThumb`
    &limit=`[[+limit]]`
    &start=`[[+offset]]`
    &album=`Carousel`
    &limit=`24`
    &totalVar=`gallery.total`
    &pageNavVar=`page.nav`
    ]]


    I was just wondering if there is a parameter I can use to sort the images in alphabetical order?

    This question has been answered by iusemodx. See the first response.

      www.PawsForWildlife.co.uk
      www.Borntobrick.co.uk
    • discuss.answer
      • 13226
      • 953 Posts
      If you take a closer look at the gallery snippet properties found here, you will see:
      &sort=``


      You can also sort the images by ascending or descending:
      &dir=``


      Again here, you can remove the default CSS by adding:
      &useCss=`0`


      So, at a guess a call could include the following:
      &sort=`id` &dir=`asc` &useCss=`0`


      Could be wrong so it's a trial and error situation

      WOW, just realised I am also learning a lot here smiley
        • 7527
        • 437 Posts
        I cannot believe the amount I have learned in the last week or so! I have tried the above, I just had to tweak the sort parameter to this:

        &sort=`name`
        &dir=`asc` 
        &useCss=`0`


        And it all works. Thank you
          www.PawsForWildlife.co.uk
          www.Borntobrick.co.uk