コード例 #1
0
 private function create_posts($number = 5, $current_post_index = 2)
 {
     $user_id = $this->create_user('administrator');
     $posts = $this->factory->post->create_many($number, array('post_author' => $user_id));
     $GLOBALS['post_ID'] = $posts[$current_post_index];
     $current_post = get_post($posts[$current_post_index]);
     c2c_AdminPostNavigation::do_meta_box($current_post->post_type, 'normal', $current_post);
     return $posts;
 }
コード例 #2
0
 private function create_posts($number = 5, $current_post_index = 2)
 {
     $user_id = $this->create_user('administrator');
     $posts = $this->factory->post->create_many($number, array('post_author' => $user_id));
     // Set publish_date to be different days. The default is now(), which the
     // script runs fast enough that all posts appear published at same second.
     foreach ($posts as $i => $post) {
         $new_date = '2' . str_pad($this->run_number++, 3, '0', STR_PAD_LEFT) . '-01-' . str_pad($i + 1, 2, '0', STR_PAD_LEFT) . ' 13:01:00';
         wp_update_post(array('ID' => $post, 'edit_date' => true, 'post_date' => $new_date, 'post_date_gmt' => $new_date), true);
     }
     $GLOBALS['post_ID'] = $posts[$current_post_index];
     $current_post = get_post($posts[$current_post_index]);
     c2c_AdminPostNavigation::do_meta_box($current_post->post_type, 'normal', $current_post);
     return $posts;
 }