Support » Plugin: Airpress » How to sort in descending order via Virtual Post field

  • Resolved Adbertram

    (@adbertram)


    I see a Sort Results field under Virtual Posts but I could find no documentation. I found that I could insert a field name in there and it sorts in ascending order but I need it to be descending. What kind of syntax do I use?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author chetmac

    (@chetmac)

    Put something like this in your functions.php file:

    
    function customize_airpress_virtualpost_query($query,$request,$virtual_post_config){
    
    	if ($virtual_post_config["name"] == "My VirtualPost Configuration Name" ){
    		$query->sort("My Airtable Field Name","desc");
    	}
    
    	return $query;
    }
    add_filter("airpress_virtualpost_query","customize_airpress_virtualpost_query",10,3);
    

    Is there a functionality behind the “Virtual Post” configuration -> “Sort results” field? Thanks Laszlo

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to sort in descending order via Virtual Post field’ is closed to new replies.