mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-04 18:05:45 +03:00
Pledges: Move create_new_pledge
to Pledge namespace
It makes more sense grouping this function with others related to the pledge CPT itself, rather than the pledge forms.
This commit is contained in:
parent
8f5a81d6e9
commit
aaf8b1a712
2 changed files with 26 additions and 20 deletions
|
@ -7,6 +7,7 @@
|
|||
namespace WordPressDotOrg\FiveForTheFuture\Pledge;
|
||||
|
||||
use WordPressDotOrg\FiveForTheFuture;
|
||||
use WP_Error;
|
||||
|
||||
defined( 'WPINC' ) || die();
|
||||
|
||||
|
@ -100,3 +101,20 @@ function register_custom_post_status() {
|
|||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new pledge post.
|
||||
*
|
||||
* @param string $name The name of the company to use as the post title.
|
||||
*
|
||||
* @return int|WP_Error Post ID on success. Otherwise WP_Error.
|
||||
*/
|
||||
function create_new_pledge( $name ) {
|
||||
$args = array(
|
||||
'post_type' => CPT_ID,
|
||||
'post_title' => $name,
|
||||
'post_status' => 'draft',
|
||||
);
|
||||
|
||||
return wp_insert_post( $args, true );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue