Forums Forums Search & Filter Pro Custom Results Page – Order results by ACF value

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #228403

    EDIT:

    $query = new WP_Query(array(
    	'post_type'			=> 'diamond_search_tool',
    	'posts_per_page'	=> -1,
    	'meta_key'			=> 'DST-carat',
    	'orderby'			=> 'meta_value',
    	'order'				=> 'ASC'
    ));

    Displays content in intended but disables the filter.
    Using Shortcodes.

    Trevor
    #228434

    You should not be adding the query into the results.php file.

    Instead use the Posts tab in the form design, and that has a sort option. Use Meta Value, select the ACF key name (make sure it DOES NOT start with an underscore) and then sort direction. See here an example:

    https://www.screencast.com/t/rVKgFNJl7FD

    Note, when you sort in this way, any post that has no value set will be excluded from the results.

    Anonymous
    #228436

    Awesome, thanks for clearing that up for me. Great support + great plugin 🙂

    Trevor
    #228440

    Thanks for getting back to me. I will close this thread for now.

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