Skip to content

Commit

Permalink
[#39] adding auction archive page to nav
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-schmidt-viget committed Dec 18, 2023
1 parent cf4452f commit e272621
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public function __construct() {
// Set the auction archive page in the main navigation
$this->set_auction_archive_posts_per_page();

// Adds the auction archive page to the pages
$this->add_auction_archive_page();

// Sets a default image
$this->set_default_feature_image();
}
Expand Down Expand Up @@ -479,6 +482,31 @@ function ( $query ) {
);
}

/**
* Adds the Auction archive page the pages section
*
* @since 1.0.0
*
* @return void
*/
private function add_auction_archive_page(): void {
add_action(
'goodbids_init_site',
function () {
$page = array(
'post_type' => 'page',
'post_title' => ucfirst( self::ARCHIVE_SLUG ),
'post_status' => 'publish',
'post_author' => 1,
'post_name' => self::ARCHIVE_SLUG,
);

wp_insert_post( $page );
}
);
}


/**
* Set the default feature image for Auction
*
Expand Down

0 comments on commit e272621

Please sign in to comment.