From f0262dc3870c344f2161036079799a79dd881adb Mon Sep 17 00:00:00 2001 From: Allen Benny Date: Fri, 26 Jul 2024 12:18:05 +0530 Subject: [PATCH] Better --- includes/Services/SiteGenService.php | 3 ++- includes/Services/SitePagesService.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/Services/SiteGenService.php b/includes/Services/SiteGenService.php index 1645fca..8922a21 100644 --- a/includes/Services/SiteGenService.php +++ b/includes/Services/SiteGenService.php @@ -931,6 +931,7 @@ public static function publish_sitemap_pages( $site_description, $content_style, continue; } + $page_name = count( explode( '/', $page['path'] ) ) > 1 ? explode( '/', $page['path'] )[1] : false; $page_content = $other_pages[ $page['slug'] ]; $post_id = SitePagesService::publish_page( $page['title'], @@ -939,7 +940,7 @@ public static function publish_sitemap_pages( $site_description, $content_style, array( 'nf_dc_page' => $page['slug'], ), - explode( '/', $page['path'] )[1] + $page_name ); if ( $update_nav_menu && ! is_wp_error( $post_id ) ) { diff --git a/includes/Services/SitePagesService.php b/includes/Services/SitePagesService.php index df49c16..83eae46 100644 --- a/includes/Services/SitePagesService.php +++ b/includes/Services/SitePagesService.php @@ -16,7 +16,7 @@ class SitePagesService { * @param string $name The page name that will be used in the slug. * @return int|\WP_Error */ - public static function publish_page( $title, $content, $is_template_no_title = false, $meta = false, $name = false ) { + public static function publish_page( $title, $content, $is_template_no_title = false, $meta = false, $name = null ) { $post = array( 'post_title' => $title, 'post_status' => 'publish',