get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'addressya_creditapp' AND post_status = 'publish' AND meta_key = '_billing_addressya_credit_status' AND meta_value = 'pending'" ) ); /* echo "
";
print_r($results);
die(); */

if(isset($_GET['status']) && $_GET['status'] !== ''){
    //$results = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'addressya_creditapp' AND post_status = 'publish' ORDER BY post_date desc" );     
    $results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'addressya_creditapp' AND post_status = 'publish' AND meta_key = '_billing_addressya_credit_status' AND meta_value =  '".$_GET['status']."'" ) );
} else {
    $results = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'addressya_creditapp' AND post_status = 'publish' ORDER BY post_date desc" ); 
}
//$results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'addressya_creditapp' AND post_status = 'publish' " ) );
//$results = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'addressya_creditapp' AND post_status = 'publish' AND meta_key = '_billing_addressya_credit_status' AND meta_value =  '$status'" ) );
//echo "
";
//print_r($results);

/* foreach($results as $result){
    //echo $result->ID;
    //echo get_post_meta($result->ID, '_billing_first_name') . "
"; echo $order_id = wp_slash( get_post_meta($result->ID, 'order_id', true ) ) . "
"; echo wp_slash( get_post_meta($result->ID, '_billing_first_name', true ) ) . "
"; echo wp_slash( get_post_meta($result->ID, '_billing_last_name', true ) ) . "
"; echo wp_slash( get_post_meta($result->ID, '_billing_addressya_credit_status', true ) ) . "
"; echo wp_slash( get_post_meta($result->ID, '_billing_addressya_uid', true ) ) . "
"; echo wp_slash( get_post_meta($result->ID, '_billing_addressya_location_city', true ) ) . "
"; echo wp_slash( get_post_meta($result->ID, '_billing_addressya_location_country', true ) ) . "
"; echo wp_slash( get_post_meta($result->ID, '_billing_addressya_location_region', true ) ) . "
"; echo wp_slash( get_post_meta($result->ID, '_billing_addressya_location_lat', true ) ) . "
"; echo get_post_meta(wp_slash( get_post_meta($result->ID, 'order_id', true ) ), '_billing_addressya_locationId', true ) . "
"; echo wp_slash( $result->post_date ) . "
"; // $location_data = ADDRESSYA_Admin_API::getLocationForOrder( get_post_meta($result->ID, '_billing_addressya_uid', true), get_post_meta($order_id, '_billing_addressya_locationId', true ) ); //print_r($location_data['data']);die(); } */ ?>

Credit Application

    $result){ ?>
  • ID, 'order_id', true ) ); array_push( $locatioData, [ ['lat'=> (float)get_post_meta($result->ID, '_billing_addressya_location_lat', true ),'lng'=>(float)get_post_meta($result->ID, '_billing_addressya_location_lon', true )], wp_slash( get_post_meta($result->ID, '_order_total', true ) ), $result->ID, wp_slash( get_post_meta($order_id, '_billing_phone', true ) ), ] ); //$locatioData = ['lat'=>'adasd','lon'=>'asdasdads']; $appliedDate = date("d M Y", strtotime(wp_slash( $result->post_date ))); $startDate = date("d M Y", strtotime(wp_slash( get_post_meta($result->ID, '_billing_addressya_credit_contractStartDate', true ) ))); $endDate = date("d M Y", strtotime(wp_slash( get_post_meta($result->ID, '_billing_addressya_credit_contractEndDate', true ) ))); $appStatus = wp_slash( get_post_meta($result->ID, '_billing_addressya_credit_status', true ) ); $country = wp_slash( get_post_meta($result->ID, '_billing_addressya_location_country', true ) ); $region = wp_slash( get_post_meta($result->ID, '_billing_addressya_location_region', true ) ); ?>
    ID, '_billing_first_name', true ) ) . " " . wp_slash( get_post_meta($result->ID, '_billing_last_name', true ) );?>
    width="18px" />
    width="18px" />
    "; print_r($locatioData); echo "
"; */?>