Forums Forums Search & Filter Pro Sorting of results of custom post type / ACF

Viewing 5 posts - 11 through 15 (of 15 total)
  • Anonymous
    #2565

    yes exactly!
    thanks a lot, looking forward to it and let me know if I can help you with any tests.

    meanwhile, is there any option for either auto-populate a field with _GET or have a predefined value set to a field?

    thanks

    Ross Moderator
    #2629

    Got it ๐Ÿ˜‰

    
    function order_results_default( $query )
    {
        global $sf_form_data;
    	global $wp_query;
    	
        if ( $sf_form_data->is_valid_form() && $query->is_main_query() && !is_admin())
        {
    		if(!isset($wp_query->query['sort_order']))
    		{
    			$query->set('orderby', 'race_date');
    			$query->set('meta_key', 'race_date');
    			$query->set('order', 'DESC');
    		}
        }
    }
    add_action( 'pre_get_posts', 'order_results_default', 21 );

    Let me know if that works ๐Ÿ™‚

    Anonymous
    #2641

    YES!!!

    thanks so much ๐Ÿ™‚

    PS. I think it’s a quite handy feature, perhaps it would be good to include it in the admin panel

    best

    Ross Moderator
    #2705

    Yup definitely needs to be added to the admin UI ๐Ÿ™‚

    Anonymous
    #8403

    Hello!

    This solution worked for me perfectly with a page template! HOWEVER it is not working with the AJAX option!
    Any suggestion?

    Thank you in advance!

Viewing 5 posts - 11 through 15 (of 15 total)