Is that possible to calculate a meta’s value and sort based on the r
-
I am trying to sort my custom post type in wordpress while using
WP_Query
. Let’s say there is a custom field called **angle
** ( 45, 90, 120, 180,.. etc ). I could sort the values directly. But in this case, I have to sort it based onsine
orcosine
of their values. Is there any way I could do that? I am a noob to wordpress and so can’t figure this out. This is what I tried, but it didn’t work for me.$paged = ( get_query_var('page') ) ? get_query_var('page') : 1; $angles = array( 60, 90, 120 ); $args = array( "post_type" => "tables", "posts_per_page" => 15, "paged" => $paged, "meta_query" => array( array( 'key' => 'angle', 'value' => sin(deg2rad($angles)), 'compare' => 'IN', 'type' => ) ) ); $the_query = new WP_Query( $args );
Thank you so much in advance.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Is that possible to calculate a meta’s value and sort based on the r’ is closed to new replies.