<?php


// Insert Default pages
define('BANNER_PAGE', 'Home Banner');
define('HOSTING_REVIEW_PAGE', 'Web Hosting Review');
define('ABOUT_US_PAGE', 'About Us');
define('RECENT_REVIEWS_PAGE', 'Recent Reviews');
define('REVIEWS_PAGE', 'Reviews');
define('TOP_BLOG_PAGE', 'Top Blog Posts');
define('NEWSLETTER_PAGE', 'Newsletter Page');

define('BLOG_PAGE', 'Blog');

if (isset($_GET['activated']) && is_admin()){
    $defaultPagesBanner = [BANNER_PAGE, HOSTING_REVIEW_PAGE, ABOUT_US_PAGE, RECENT_REVIEWS_PAGE, TOP_BLOG_PAGE, NEWSLETTER_PAGE, BLOG_PAGE];
    for ($i = 0; $i < count($defaultPagesBanner); $i++) {
        $new_page_title = $defaultPagesBanner[$i];
        $page_check = get_page_by_title($new_page_title);
        $new_page = array(
            'post_type' => 'page',
            'post_title' => $new_page_title,
            'post_content' => '',
            'post_status' => 'publish',
            'post_author' => 1,
        );
        if(!isset($page_check->ID)){
            $new_page_id = wp_insert_post($new_page);
        }
    }
}
