Forums › Forums › Search & Filter Pro › Can get the right order Post meta (ACF post object field)
- This topic has 4 replies, 2 voices, and was last updated 6 years, 5 months ago by Trevor.
-
Anonymous(Private) July 12, 2018 at 1:54 pm #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(Private) July 12, 2018 at 4:00 pm #182401I 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(Private) July 17, 2018 at 2:11 pm #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 codefunction 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 fieldcategory
. It would be great if you could edit the docs and tell thereIf you are looking for your specific
$input_object['name']
open your web inspector and look for the data attributedata-sf-field-name="_sfm_YOUR-FIELD-NAME"
-
AuthorPosts