Skip to content

Commit

Permalink
feat(media-kit): expose method; add get_page_status method (#908)
Browse files Browse the repository at this point in the history
* feat(media-kit): expose method; add get_page_status method

* feat: more desciptive media kit page status
  • Loading branch information
adekbadek authored Sep 20, 2024
1 parent 31416ed commit 36f3af5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion includes/media-kit/class-media-kit.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function activate() {
*
* @return int|false Post ID or false if the media kit page was not found.
*/
private static function get_existing_page_id() {
public static function get_existing_page_id() {
$args = [
'post_type' => [ 'page' ],
'post_status' => [ 'publish', 'pending', 'draft', 'auto-draft', 'future', 'private' ],
Expand All @@ -93,6 +93,17 @@ private static function get_existing_page_id() {
return $query->posts[0] ?? false;
}

/**
* Get Media Kit page status.
*/
public static function get_page_status() {
$post_id = self::get_existing_page_id();
if ( ! $post_id ) {
return 'non-existent';
}
return get_post_status( $post_id );
}

/**
* A function to create a Publisher Media Kit page automatically.
*
Expand Down

0 comments on commit 36f3af5

Please sign in to comment.