这是获取用户位置的代码片段。
如何在$temp[0]=$post\\u x->post\\u title;中获取到帖子的链接?
(我在上面找到了相关链接)
<?php
global $seller_details;
$loc_arr = array();
while(have_posts()) : the_post(); global $post,$product;
$loc_arr[get_the_ID()] = get_post_meta(get_the_ID(), \'my_location\', true);
endwhile;
wp_reset_query();
$locations = array();
$i = 1;
foreach( $loc_arr as $key => $str ){
$temp = array();
$ex = explode(\',\', $str);
$post_x = get_post($key);
$temp[0] = $post_x->post_title;
$temp[1] = $ex[0];
$temp[2] = $ex[1];
$temp[3] = $i;
$locations[] = $temp;
$i ++;
}
$locations = json_encode($locations);