Forums Forums Search & Filter Pro Custom order of post meta options

Tagged: 

Viewing 11 post (of 11 total)
  • Ross Moderator
    #195850

    Hi Matt

    I had a look, and yeah that’s pretty much it.

    The code for re-organising arrays in PHP is never pretty, especially if you want to put a value, but there are always a bunch of ways to do the same thing. I don’t have the code written and handy but a couple of other approaches could be:

    1) Splice the array and rejoin like you mentioned before
    2) Create a list array("red", "green", "blue") of the order you want all the elements and loop through it, adding the $input_object['options'] one by one to a new array, then replace ['options'] with the new array, in the order you wanted

    I hope that helps, but it looks like you are on the right track already.

    Thanks

Viewing 11 post (of 11 total)