Skip to main content
clarity
Source Link
shanebp
  • 5.1k
  • 6
  • 27
  • 40

In your WP_Query, only return ids. https://developer.wordpress.org/reference/classes/wp_query/#return-fields-parameter

Create an empty array, $myArray = array();. Then loop thru the results of the query, $your_query->posts and fetch your field value for each id and add the result and the id to a new array in $myArray.

Then sort the arrays in $myArray by the price.

Then do anothera loop thru $myArray to output the display you want for each post id.

In your WP_Query, only return ids. https://developer.wordpress.org/reference/classes/wp_query/#return-fields-parameter

Create an empty array, $myArray = array();. Then loop thru the results of the query, $your_query->posts and fetch your field value for each id and add the result and the id to a new array in $myArray.

Then sort the arrays in $myArray by the price.

Then do another loop to output the display you want for each post id.

In your WP_Query, only return ids. https://developer.wordpress.org/reference/classes/wp_query/#return-fields-parameter

Create an empty array, $myArray = array();. Then loop thru the results of the query, $your_query->posts and fetch your field value for each id and add the result and the id to a new array in $myArray.

Then sort the arrays in $myArray by the price.

Then do a loop thru $myArray to output the display you want for each post id.

Source Link
shanebp
  • 5.1k
  • 6
  • 27
  • 40

In your WP_Query, only return ids. https://developer.wordpress.org/reference/classes/wp_query/#return-fields-parameter

Create an empty array, $myArray = array();. Then loop thru the results of the query, $your_query->posts and fetch your field value for each id and add the result and the id to a new array in $myArray.

Then sort the arrays in $myArray by the price.

Then do another loop to output the display you want for each post id.