25 lines
562 B
PHP
25 lines
562 B
PHP
<?php
|
|
/**
|
|
* Resource-post predicate.
|
|
*
|
|
* @package AKSRT
|
|
*/
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
if (!function_exists('aksrt_is_resource_post')) {
|
|
/**
|
|
* 是否为资源帖:普通 post + _aksrt_is_resource meta。
|
|
*
|
|
* @param int|WP_Post|null $post
|
|
* @return bool
|
|
*/
|
|
function aksrt_is_resource_post($post = null): bool {
|
|
$p = get_post($post);
|
|
if (!($p instanceof WP_Post) || $p->post_type !== 'post') {
|
|
return false;
|
|
}
|
|
return (bool) get_post_meta($p->ID, '_aksrt_is_resource', true);
|
|
}
|
|
}
|