increment_views($post_id); } } } // Increment the post view count private function increment_views($post_id) { $views = get_post_meta($post_id, 'abcbiz_post_views', true); $views = $views ? (int) $views : 0; $views++; update_post_meta($post_id, 'abcbiz_post_views', $views); } // Method to get post views (for use in templates or other logic) public static function get_views($post_id) { $views = get_post_meta($post_id, 'abcbiz_post_views', true); return $views ? (int) $views : 0; } }