wordpress twentytwenty主题访问计数
也不知道为什么wordpress官方主题中从来不加入文章访问计数,就像以前的ios从来不加android功能一 … 阅读更多
/* 访问计数 */ function record_visitors() { if (is_singular()) { global $post; $post_ID = $post->ID; if($post_ID) { $post_views = (int)get_post_meta($post_ID, 'views', true); if(!update_post_meta($post_ID, 'views', ($post_views+1))) { add_post_meta($post_ID, 'views', 1, true); } } } } add_action('wp_head', 'record_visitors');
也不知道为什么wordpress官方主题中从来不加入文章访问计数,就像以前的ios从来不加android功能一 … 阅读更多