refactor(resource): drop aksrt_resource CPT residue, post+meta only

This commit is contained in:
kate522 committed 2026-07-13 23:47:04 +08:00
1 parent 24c135aeec
commit 1af0e9b753
22 files changed
+362 -986

No files matched your search

+17 -29
View File
@@ -412,10 +412,7 @@ if (!function_exists('aksrt_resource_download_cost')) {
if (!function_exists('aksrt_resource_meta_query')) {
/**
* 「是资源」WP_Query meta_query 片段。
*
* v3.4: 资源 = post + _aksrt_is_resource = 1。
* 兼容历史 aksrt_resource CPT 时由调用方决定是否额外加 post_type。
* 「是资源」WP_Query meta_query 片段:post + _aksrt_is_resource = 1。
*
* @return array
*/
@@ -428,26 +425,9 @@ if (!function_exists('aksrt_resource_meta_query')) {
}
}
if (!function_exists('aksrt_resource_post_types')) {
/**
* 资源查询使用的 post_type 数组。
*
* 当历史 aksrt_resource CPT 仍在站点中存在(未迁移完成)时,会自动包含。
*
* @return array
*/
function aksrt_resource_post_types(): array {
$types = ['post'];
if (post_type_exists('aksrt_resource')) {
$types[] = 'aksrt_resource';
}
return $types;
}
}
if (!function_exists('aksrt_resource_archive_url')) {
/**
* 取资源归档页 URL(v3.4 起统一为 /resources/)。
* 资源列表页 URL(/resources/)。
*/
function aksrt_resource_archive_url(): string {
return home_url('/resources/');
@@ -456,19 +436,27 @@ if (!function_exists('aksrt_resource_archive_url')) {
if (!function_exists('aksrt_is_resource_archive')) {
/**
* 当前请求是否为资源归档(/resources)。
*
* 兼容历史 aksrt_resource CPT 归档。
* 当前请求是否为资源列表(/resources 虚拟归档)。
*/
function aksrt_is_resource_archive(): bool {
if (function_exists('post_type_exists') && post_type_exists('aksrt_resource')
&& function_exists('is_post_type_archive') && is_post_type_archive('aksrt_resource')) {
return true;
}
return (bool) get_query_var('aksrt_is_resource_archive');
}
}
/**
* Normalize homepage-module content scope.
* Values: post | resource (resource = posts marked _aksrt_is_resource).
*/
if (!function_exists('aksrt_normalize_content_scope')) {
function aksrt_normalize_content_scope($scope): string {
$scope = sanitize_key((string) $scope);
if ($scope === 'resource') {
return 'resource';
}
return 'post';
}
}
if (!function_exists('aksrt_detect_cloud_service')) {
/**
* 从下载链接自动识别云盘服务商。