wordpress获取相应数据代码

文章
<?php $count_posts = wp_count_posts(); echo $published_posts = $count_posts->publish; ?>
总浏览
<?php get_totalviews(true, true, true); ?>
评论
<?php $total_comments = get_comment_count(); echo $total_comments['approved'];?>
最后更新
<?php $last = $wpdb->get_results("SELECT MAX(post_modified) "+"AS MAX_m FROM $wpdb->posts "+"WHERE (post_type = 'post' OR post_type = 'page') "+"AND (post_status = 'publish' OR post_status = 'private')");$last = date('Y年n月j日', strtotime($last[0]->MAX_m));echo $last; ?>
分类目录
<?php echo $count_categories = wp_count_terms('category'); ?>



会员:
<?php $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users"); echo $users; ?>
链接:
<?php $link = $wpdb->get_var("+"SELECT COUNT(*)"+" FROM $wpdb->links "+"WHERE link_visible = 'Y'"); echo $link; ?>
页面:
<?php $count_pages = wp_count_posts('page'); echo $page_posts = $count_pages->publish; ?>
草稿:
<?php $count_posts = wp_count_posts(); echo $draft_posts = $count_posts->draft; ?>
标签:
<?php echo $count_tags = wp_count_terms('post_tag'); ?>

人已赞赏
教程大全

WordPress美化之文章内页新增彩色渐变框

2020-5-27 14:44:40

教程大全

16节实用性爆棚PS课

2020-6-10 15:08:37

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索