Order MB Group by Custom Data

Support General Order MB Group by Custom DataResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #44382
    SolaceSolace
    Participant

    Hi, is it possible to take data from a Meta Box group and order by ASC or DESC? The use case here is I'm building a team module with separate First Name and Last Name fields and I want to organize them by Last name first in the front end and go descending last name A->Z regardless of the alphabetization of the first name.

    #44388
    PeterPeter
    Moderator

    Hello,

    I think it is possible. You can use some PHP sort array functions to sort the array by key or value. Following some links below
    https://www.w3schools.com/php/php_arrays_sort.asp
    https://stackoverflow.com/questions/1673259/sort-array-by-value-alphabetically-php

    #44392
    SolaceSolace
    Participant

    Oh thanks Peter! I'm using the Meta Box builder interface (not the coding interface). Can I still use these array functions for the group? Or do I have to code this in?

    #44404
    PeterPeter
    Moderator

    Hello,

    The builder helps you to create the field, you still need to use the code to output the field value, and custom code to sort the value.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.