Add a post status for pledges

This commit is contained in:
Corey McKrill 2019-10-01 14:47:11 -07:00
parent abbfe6dad1
commit 46bcb46d40
No known key found for this signature in database
GPG key ID: C2C0746F7BF17E38

View file

@ -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 <span class="count">(%s)</span>', 'Deactivated <span class="count">(%s)</span>', 'wporg' ),
'public' => false,
'internal' => false,
'protected' => true,
CPT_ID => true, // Custom parameter to streamline its use with the Pledge CPT.
)
);
}