From e272621057e3da9e79bcb0976648d5a5bb684d4d Mon Sep 17 00:00:00 2001 From: Nathan Schmidt <91974372+nathan-schmidt-viget@users.noreply.github.com> Date: Mon, 18 Dec 2023 16:19:47 -0700 Subject: [PATCH] [#39] adding auction archive page to nav --- .../src/classes/Auctions/Auctions.php | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php b/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php index ef8e438ee..795cf7f09 100644 --- a/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php +++ b/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php @@ -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(); } @@ -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 *