wordpress查询
获取当前页面内容
$now_id=get_the_ID();
$now_post=get_post($now_id);
$now_content=$now_post->post_content;
/*
获取当前文章内容,根据文章内容来获取
*/
$now_id=get_the_ID();
$now_post=get_post($now_id);
$now_content=$now_post->post_content;
$content_json=json_decode($now_content,true);
//print_r($content_json);
$text_title=$content_json["title"];
$text_small=$content_json["title-small"];
$category_text=$content_json["category"];
$args = array(
'post_type' => 'post',
'showposts' => 8,
"category_name"=>$category_text,
'orderby' => 'date',
'paged' => $paged,
);
$loop = new WP_Query($args);
查询说明
$args = array(
'post_type' => 'post',
'showposts' => 8,
"category_name"=>$category_text,
'orderby' => 'date',
'paged' => $paged,
);
post_type为查询类型category_name为文章的别名
剩下的看API即可..以后会逐步更新