【发布时间】:2017-03-04 09:55:16
【问题描述】:
在那里我有我想显示的数据后元
$command = $_GET['command'];
switch ($command) {
case 'list_product':
$loop = new WP_Query(
array(
'post_type' => 'product'
// 'showposts' => 4,
// 'meta_key' => '_sale_price',
// 'meta_value' => '0',
// 'meta_compare' => '>=',
)
);
if($loop->have_posts()) :
$data = array( "api_status" => 1, "api_message" => "success");
while ( $loop->have_posts() ) : $loop->the_post();
$data[] = array("id" => get_the_ID(),
"post_name" => get_the_title(),
"post_meta" => get_post_meta(get_the_ID());
endwhile;
echo json_encode($data);
break;
}
在那里我想显示数据:
元数据具有相同的post id数据,
我想在内部细节中循环数据,请有人帮助我或告诉我需要改进哪些代码以便我的代码正常工作?
【问题讨论】:
-
等等,所以你只是想把它作为 JSON 格式?
-
确定..你能帮我吗?
标签: javascript php json wordpress