想写好一个作者页面,作者数据是必不可少的,例如用户/作者文章数量和评论数量,这些数据获取也是非常简单的,都有相对应的代码,下面本站一一列出:
//当前登录用户
get_current_user_id();
// 或者
global $user_id;
//文章数量
count_user_posts($user_id )
//评论数量
global $wpdb;
$count_user_comments = $wpdb->get_var( $wpdb->prepare("Select count(comment_ID) from $wpdb->comments where user_id = %d", $user_id) );
var_dump($count_user_comments);
文章来源于互联网:WordPress调用当前用户的文章/评论数量
hello!,I like your writing very much! share we communicate more about your post on AOL? I need an expert on this area to solve my problem. May be that’s you! Looking forward to see you. ラ ブ ド ー ル
分秒帧: http://iraqilug.com/