refactor(resource): drop aksrt_resource CPT residue, post+meta only
This commit is contained in:
@@ -20,19 +20,14 @@ if (!in_array($layout, ['card', 'list', 'masonry', 'grid-cms'], true)) {
|
||||
}
|
||||
|
||||
$args = [
|
||||
'posts_per_page' => $count,
|
||||
'post_status' => 'publish',
|
||||
'no_found_rows' => true,
|
||||
];
|
||||
if ($cat_id > 0) {
|
||||
$args['cat'] = $cat_id;
|
||||
// 分类页通常希望同时展示资源 post,post 已天然包含资源;旧 CPT 兼容时合并
|
||||
$args['post_type'] = function_exists('aksrt_resource_post_types')
|
||||
? array_unique(array_merge(['post'], aksrt_resource_post_types()))
|
||||
: ['post'];
|
||||
} else {
|
||||
$args['post_type'] = 'post';
|
||||
}
|
||||
'post_type' => 'post',
|
||||
'posts_per_page' => $count,
|
||||
'post_status' => 'publish',
|
||||
'no_found_rows' => true,
|
||||
];
|
||||
if ($cat_id > 0) {
|
||||
$args['cat'] = $cat_id;
|
||||
}
|
||||
|
||||
$query = new WP_Query($args);
|
||||
if (!$query->have_posts()) {
|
||||
|
||||
Reference in New Issue
Block a user