Created
January 6, 2016 16:03
-
-
Save cdevroe/a3c754e94d4e0b597105 to your computer and use it in GitHub Desktop.
WordPress is_published is_draft functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Determine whether a post or page is published or not. | |
* | |
* @return bool | |
*/ | |
function is_published(){ | |
$post = get_post(); | |
if ( $post->post_status == 'publish' ) return true; | |
return false; | |
} | |
/** | |
* Determine whether a post or page is published or not. | |
* | |
* @return bool | |
*/ | |
function is_draft(){ | |
$post = get_post(); | |
if ($post->post_status == 'draft') return true; | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment