WordPress函数get_post_status(),是用来获取文章状态的,函数代码位于位于wp-includes/post.php中。
函数介绍:
<?php get_post_status($ID); ?>
函数用法:
<?php
$ post_status = get_post_status ( 888 );//假设id为888的文章类型是“publish”
echo $post_status;
?>
函数代码:
function get_post_status($ID = '') {
$post = get_post($ID);
if ( !is_object($post) )
return false;
if ( 'attachment' == $post->post_type ) {
if ( 'private' == $post->post_status )
return 'private';
// Unattached attachments are assumed to be published
if ( ( 'inherit' == $post->post_status ) && ( 0 == $post->post_parent) )
return 'publish';
// Inherit status from the parent
if ( $post->post_parent && ( $post->ID != $post->post_parent ) )
return get_post_status($post->post_parent);
}
return $post->post_status;//返回文章的post_status字段
}
-
WordPress函数:wp_delete_attachment 删除附件WordPress函数:wp_delete_attachment 删除评论
-
WordPress函数:wp_update_user 更新用户信息WordPress函数:wp_update_user 更新用户信息
-
WordPress函数:add_shortcode 添加短代码WordPress函数:add_shortcode 添加短代码
-
WordPress函数:remove_shortcode 删除短代码WordPress函数:remove_shortcode 删除短代码
-
WordPress函数:current_user_can_for_blog 多站点下检查用户权限WordPress函数:current_user_can_for_blog 多站点下检查用户权限
-
2款CMS小程序之追格资讯小程序(WordPress小程序)CMS一般指内容管理系统,内容管理系统(Content Management System,CMS),比如WordPress也是CMS系统,当然还有更多。
暂无评论,抢个沙发...