我需要遍历如下所示的行,但显然这段代码出错了。我刚刚在此处添加了 foreach 循环,以显示我需要它循环的位置。希望这是有道理的...
$data = array(
'cols' => array(
array('id' => '', 'label' => 'Date', 'type' => 'string'),
array('id' => '', 'label' => 'Score', 'type' => 'number'),
array('id' => '', 'label' => 'Result', 'type' => 'number')
),
'rows' => array(
//need this query to loop through the rows
$the_query3 = new WP_Query( 'post_type' => 'handicap' );
foreach($the_query3->posts as $post) {
array('c' => array(array('v' => get_post_meta($post->ID, 'hcap_date', true)), array('v' => get_post_meta($post->ID, 'hcap_score', true)), array('v' => $result))),
};// end foreach loop
)
);
$chart->load(json_encode($data));