Sort customs field in alphabetic order

Home Forums Calendar Products Filter Bar Sort customs field in alphabetic order

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1327315
    Uwe Matern
    Participant

    Good Morning from Hamburg,
    we use several of the TEC plugins including the Filter Bar. We provide an (art)event page with a number of custom fields which are also part of our filter bar. There is one custom field which is called “DozentIn” means something like an instructructor for an art course. This filed is a text field and contains the name of the DozentIn with surname and lastname.

    So, we would like to have the values of this field shown in alphabetic order if they are used for selection in the filter bar.

    Is there any way to make that happen?

    Best regards
    Uwe

    #1327840
    Jennifer
    Keymaster

    Hi Uwe,

    Thanks for reaching out!

    While this is not a feature that is available out of the box, we do have a snippet that you can add to your functions.php file in your child theme to accomplish this. To get the slug for the additional field you want to reorder, you can right-click the field in Filter Bar and use the inspector tool (see screenshot). To apply this to multiple fields, you can change

    if ( $slug == '_ecp_custom_2' ) {

    to

    if ( $slug == '_ecp_custom_2' || $slug == '_ecp_custom_3' ) {

    and so on to add as many as you need.

    Let me know how it goes or if you have any questions!

    Thanks,

    Jennifer

    #1328348
    Uwe Matern
    Participant

    Hi Jennifer,

    thanks for the feedback. I implemented it in the functions.php and it works as described.

    Best regards

    Uwe

    #1328378
    Jennifer
    Keymaster

    Hi Uwe,

    Glad to hear that worked for you! I’ll go ahead and close out this thread, but please feel free to open a new one if you have any further questions!

    Thanks,

    Jennifer

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Sort customs field in alphabetic order’ is closed to new replies.