function page_on_activation($templateID = 'welcome')
 {
     global $user_ID;
     $data = $this->activation_page_data();
     $page = array('post_type' => 'page', 'post_status' => 'draft', 'post_author' => $user_ID, 'post_title' => __('PageLines Getting Started', 'pagelines'), 'post_content' => $this->getting_started_content(), 'post_name' => 'pl-getting-started', 'template' => 'welcome');
     $post_data = wp_parse_args($data, $page);
     // Check or add page (leave in draft mode)
     $pages = get_pages(array('post_status' => 'draft'));
     $page_exists = false;
     foreach ($pages as $page) {
         $name = $page->post_name;
         if ($name == $post_data['post_name']) {
             $page_exists = true;
             $id = $page->ID;
         }
     }
     if (!$page_exists) {
         $id = wp_insert_post($post_data);
     }
     pl_set_page_template($id, $post_data['template'], 'both');
     return $id;
 }
Example #2
0
 function save_meta_options($postID)
 {
     $post = $_POST;
     if (isset($post['update']) || isset($post['save']) || isset($post['publish'])) {
         $user_template = isset($post['pagelines_template']) ? $post['pagelines_template'] : '';
         if ($user_template != '') {
             pl_set_page_template($postID, $user_template, 'both');
         }
     }
 }