Forums Forums Search & Filter Pro Can get the right order Post meta (ACF post object field)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Trevor
    #182401

    I think you would need to refer to the WordPress Codex for sorting WP_Query and use our Edit Query Arguments filter:

    https://searchandfilter.com/documentation/action-filter-reference/#edit-query-arguments

    Anonymous
    #182762

    @Trevor I think I am explaining it wrong. I am not looking to change to order of the posts, I want to change the order of a specific S&F filter that I created using the S&F admin tools which is a list of checkboxes.

    This is what the field in S&F looks like

    And here is the filter on the front end of my site

    With CSS I already add icons for each item in the filter and that is the correct order. Now I need to hook in to the filter and change the order so that it is the same as in my admin, but I have no idea how to do that.

    I think I need the sf_input_object_pre filter and I already have this code

    function filter_function_name($input_object, $sfid) {
    
      if($input_object['name'] == '_sfm_category') {
        $input_object['attributes']['class'] = 'my-test-class';
        return $input_object;
      }
      return $input_object;
    }
    add_filter('sf_input_object_pre', __NAMESPACE__ . '\\filter_function_name', 10, 2);

    It took me an hour to figure out how I would get this name _sfm_category from my field category. It would be great if you could edit the docs and tell there

    If you are looking for your specific $input_object['name'] open your web inspector and look for the data attribute data-sf-field-name="_sfm_YOUR-FIELD-NAME"

    Trevor
    #182810
    This reply has been marked as private.
    Trevor
    #182823

    Great to speak with you. All it needed was to set the source of the field to manual, and to drag and drop the terms into the desired order and give them the correct labels.

Viewing 4 posts - 1 through 4 (of 4 total)