wp_create_nonce( 'santamas_notice_dismiss' ) ); wp_localize_script( 'santamas-admin-script', 'santamasNUX', $santamas_nux ); } public function admin_notices() { global $pagenow; if ( true === (bool) get_option( 'santamas_nux_dismissed' ) ) { return; } ?>

'1' ); $set = ''; if ( ! empty( $_REQUEST['homepage'] ) && 'on' === $_REQUEST['homepage'] ) { $set = 'homepage'; if ( current_user_can( 'edit_pages' ) && 'page' === get_option( 'show_on_front' ) ) { $this->_assign_page_template( get_option( 'page_on_front' ), 'template-home.php' ); } $args['santamas_tasks'] = $set; if ( current_user_can( 'manage_options' ) ) { // Make sure the fresh_site flag is set to true. update_option( 'fresh_site', true ); } } wp_safe_redirect( add_query_arg( $args, admin_url( 'customize.php' ) ) ); die(); } /** * Update Storefront fresh site flag. * */ public function log_fresh_site_state() { if ( null === get_option( 'santamas_nux_fresh_site', null ) ) { update_option( 'santamas_nux_fresh_site', get_option( 'fresh_site' ) ); } } /** * Given a page id assign a given page template to it. * */ private function _assign_page_template( $page_id, $template ) { if ( empty( $page_id ) || empty( $template ) || '' === locate_template( $template ) ) { return false; } update_post_meta( $page_id, '_wp_page_template', $template ); } /** * Starter content. * */ public function starter_content() { $nextWeek = date('m/d/Y', strtotime('+1 week')); // Define and register starter content to showcase the theme on new sites. $starter_content = array( // Specify the core-defined pages to create and add custom thumbnails to some of them. 'posts' => array( 'home' => array( 'template' => 'template-home.php' ), 'about' => array( 'thumbnail' => '{{sales-girl}}', 'post_title' => _x( 'What We Do', 'Theme starter content', 'santamas' ), 'post_content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' ), 'contact' => array( 'thumbnail' => '{{city-image}}', ), 'consulting' => array( 'post_type' => 'page', 'post_title' => 'Financial Consulting', 'thumbnail' => '{{clock}}', 'post_content' => 'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.' ), 'blog' ), // Create the custom image attachments used as post thumbnails for pages. 'attachments' => array( 'city-image' => array( 'post_title' => _x( 'ChristMas', 'Theme starter content', 'santamas' ), 'file' => 'images/city.jpg', // URL relative to the template directory. ), 'sales-girl' => array( 'post_title' => _x( 'ChristMas Girl', 'Theme starter content', 'santamas' ), 'file' => 'images/sales-girl.png', // URL relative to the template directory. ), 'clock' => array( 'post_title' => _x( 'ChristMas Bell', 'Theme starter content', 'santamas' ), 'file' => 'images/clock.png', // URL relative to the template directory. ), 'santamas-logo' => array( 'post_title' => _x( 'SantaMas Logo', 'Theme starter content', 'santamas' ), 'file' => 'images/santamas-logo.png', // URL relative to the template directory. ) ), // Default to a static front page and assign the front and posts pages. 'options' => array( 'show_on_front' => 'page', 'page_on_front' => '{{home}}', 'page_for_posts' => '{{blog}}', ), // Set the front page section theme mods to the IDs of the core-registered pages. 'theme_mods' => array( 'santamas_banner_title' => _x( 'Success usually comes to those who are too busy to be looking for it.', 'Theme starter content', 'santamas' ), 'santamas_banner_sub_title' => _x( '-- Henry David Thoreau', 'Theme starter content', 'santamas' ), 'santamas_banner_text1' => _x( 'Read More', 'Theme starter content', 'santamas' ), 'santamas_banner_link1' => '#', 'santamas_banner_text2' => _x( 'Buy Tickets', 'Theme starter content', 'santamas' ), 'santamas_banner_link2' => '#', 'santamas_about_page' => '{{about}}', 'santamas_counter_count1' => '450', 'santamas_counter_title1' => _x( 'Projects Completed', 'Theme starter content', 'santamas' ), 'santamas_counter_icon1' => 'fa fa-briefcase', 'santamas_counter_count2' => '10', 'santamas_counter_title2' => _x( 'Awards Won', 'Theme starter content', 'santamas' ), 'santamas_counter_icon2' => 'fa fa-trophy', 'santamas_counter_count3' => '124', 'santamas_counter_title3' => _x( 'OnGoing Projects', 'Theme starter content', 'santamas' ), 'santamas_counter_icon3' => 'fa fa-suitcase', 'santamas_counter_count4' => '500', 'santamas_counter_title4' => _x( 'Employee Working', 'Theme starter content', 'santamas' ), 'santamas_counter_icon4' => 'fa fa-user-secret', 'santamas_event_info' => _x( 'We are soon opening our new branch at NewYork with lots of exciting offers.', 'Theme starter content', 'santamas' ), 'santamas_event_date' => $nextWeek, 'santamas_featured_title' => _x( 'Our Services', 'Theme starter content', 'santamas' ), 'santamas_featured_sub_title' => 'Auctor orci proin consequat magna natoque mattis nostra eiusmod esse lunga laboriosam luctus pulvinar tenetur fugito similique', 'santamas_featured_page1' => '{{consulting}}', 'santamas_featured_page2' => '{{consulting}}', 'santamas_featured_page3' => '{{consulting}}', 'santamas_blog_title' => _x( 'Latest Blog', 'Theme starter content', 'santamas' ), 'santamas_blog_sub_title' => _x( 'Get information on everything.', 'Theme starter content', 'santamas' ), 'santamas_social_facebook' => '#', 'santamas_social_twitter' => '#', 'santamas_social_google_plus' => '#', 'santamas_social_pinterest' => '#', 'custom_logo' => '{{santamas-logo}}', 'santamas_footer_logo' => get_template_directory_uri().'/images/santamas-logo.png' ), // Set up nav menus for each of the two areas registered in the theme. 'nav_menus' => array( // Assign a menu to the "top" location. 'santamas-main-menu' => array( 'name' => __( 'Main Menu', 'santamas' ), 'items' => array( 'link_home', 'page_about', 'page_blog', 'page_contact', ), ), 'santamas-footer-menu' => array( 'name' => __( 'Footer Menu', 'santamas' ), 'items' => array( 'link_home', 'page_about', 'page_blog', 'page_contact', ), ) ), ); $starter_content = apply_filters( 'santamas_starter_content', $starter_content ); add_theme_support( 'starter-content', $starter_content ); } /** * Filters starter content and remove some of the content if necessary. * */ public function filter_start_content( $content, $config ) { if ( ! isset( $_GET['santamas_starter_content'] ) || 1 !== absint( $_GET['santamas_starter_content'] ) ) { // We only allow starter content if the users comes from the NUX wizard. return $content; } $set = ''; if ( isset( $_GET['santamas_tasks'] ) && '' !== sanitize_text_field( $_GET['santamas_tasks'] ) ) { $set = sanitize_text_field( $_GET['santamas_tasks'] ); } if( $set == 'homepage'){ if ( current_user_can( 'edit_pages' ) && 'page' === get_option( 'show_on_front' ) ) { unset( $content['options'] ); unset( $content['posts']['home'] ); unset( $content['posts']['blog'] ); } } return $content; } } endif; return new Santamas_Starter_Content();