mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-20 10:03:43 +03:00
Add a post status for pledges
This commit is contained in:
parent
abbfe6dad1
commit
46bcb46d40
|
@ -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.
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue