From 46bcb46d404241c07c8b9667016ab8b30c2040de Mon Sep 17 00:00:00 2001
From: Corey McKrill <916023+coreymckrill@users.noreply.github.com>
Date: Tue, 1 Oct 2019 14:47:11 -0700
Subject: [PATCH] Add a post status for pledges
---
plugins/wporg-5ftf/includes/pledge.php | 35 ++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/plugins/wporg-5ftf/includes/pledge.php b/plugins/wporg-5ftf/includes/pledge.php
index fd4d8d2..bad1f69 100755
--- a/plugins/wporg-5ftf/includes/pledge.php
+++ b/plugins/wporg-5ftf/includes/pledge.php
@@ -16,10 +16,22 @@ const SLUG = 'pledge';
const SLUG_PL = 'pledges';
const CPT_ID = FiveForTheFuture\PREFIX . '_' . SLUG;
-add_action( 'init', __NAMESPACE__ . '\register_custom_post_type', 0 );
+add_action( 'init', __NAMESPACE__ . '\register', 0 );
/**
- * Register the post type.
+ * Register all the things.
+ *
+ * @return void
+ */
+function register() {
+ register_custom_post_type();
+ register_custom_post_status();
+}
+
+/**
+ * Register the post type(s).
+ *
+ * @return void
*/
function register_custom_post_type() {
$labels = array(
@@ -71,3 +83,22 @@ function register_custom_post_type() {
register_post_type( CPT_ID, $args );
}
+
+/**
+ * Register the post status(es).
+ *
+ * @return void
+ */
+function register_custom_post_status() {
+ register_post_status(
+ FiveForTheFuture\PREFIX . '-deactivated',
+ array(
+ 'label' => __( 'Deactivated', 'wporg' ),
+ 'label_count' => _n_noop( 'Deactivated (%s)', 'Deactivated (%s)', 'wporg' ),
+ 'public' => false,
+ 'internal' => false,
+ 'protected' => true,
+ CPT_ID => true, // Custom parameter to streamline its use with the Pledge CPT.
+ )
+ );
+}