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

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #182395

    I need to have a really specific order of a filter in S&F the filter is an Post meta/Choice/Checkbox item and the meta key is my ACF post object field selected. The ACF post object fields is ordered with the Intuitive Custom Post Order plugin and this is the order I need.

    In S&F Post meta -> options I can set the Order options by: but none of these options are the one I want. I thought setting it to none would ensure the default order which will be the one set my the Intuitive Custom Post Order plugin, but this is not the case. How can I get the order I want or do I have to do some really weird CSS/JS hacks to get this the way I want?

    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 5 posts - 1 through 5 (of 5 total)