Добрый вечер помогите разобраться с логикой
global $current_user;
wp_get_current_user() ;
$user = $current_user->user_login;
global $wpdb;
$newtable = $wpdb->get_results( "SELECT * FROM wp_report_user WHERE `user` ='$user'");
var_dump($newtable);
который выводит вот такую структуру
array(3) {
[0]=>
object(stdClass)#1795 (12) {
["id"]=>
string(1) "1"
["user"]=>
string(5) "admin"
["cust_part_no"]=>
string(46) "Order: 29136741 PO: T-171031-6 Date: 11/1/2017"
["quantity"]=>
string(1) "1"
["material"]=>
string(8) "Tungsten"
["purity"]=>
string(5) "99.95"
["size"]=>
string(45) "Thickness: 0.25 Inch(es) Diameter: 3 Inch(es)"
["form"]=>
string(7) "Targets"
["temper"]=>
string(11) "Unspecified"
["status"]=>
string(7) "Shipped"
["expected"]=>
string(10) "2017-11-22"
["tracking"]=>
string(18) "1z2882140364383199"
}
[1]=>
object(stdClass)#1786 (12) {
["id"]=>
string(1) "3"
["user"]=>
string(5) "admin"
["cust_part_no"]=>
string(46) "Order: 29136570 PO: T-170928-5 Date: 9/29/2017"
["quantity"]=>
string(1) "2"
["material"]=>
string(8) "Aluminum"
["purity"]=>
string(6) "99.999"
["size"]=>
string(48) "Thickness: 0.125 Inch(es) Diameter: 1.5 Inch(es)"
["form"]=>
string(7) "Targets"
["temper"]=>
string(11) "Unspecified"
["status"]=>
string(7) "Shipped"
["expected"]=>
string(10) "2017-11-22"
["tracking"]=>
string(18) "1z2882140364383199"
}
[2]=>
object(stdClass)#1865 (12) {
["id"]=>
string(1) "4"
["user"]=>
string(5) "admin"
["cust_part_no"]=>
string(46) "Order: 29136741 PO: T-171031-6 Date: 11/1/2017"
["quantity"]=>
string(1) "5"
["material"]=>
string(8) "Tungsten"
["purity"]=>
string(5) "33.99"
["size"]=>
string(45) "Thickness: 0.25 Inch(es) Diameter: 3 Inch(es)"
["form"]=>
string(7) "Targets"
["temper"]=>
string(11) "Unspecified"
["status"]=>
string(7) "Shipped"
["expected"]=>
string(10) "2017-11-22"
["tracking"]=>
string(18) "2z2882140364383198"
}
}
Для всех записей с одинаковым полем tracking нужно выводить один шаблон, а для остальных другой