Advertisement
Guest User

post between ifs

a guest
May 15th, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.67 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Post a Guide
  4. */
  5. get_header(); ?>
  6. <?php
  7. if(isset($_GET['step'])){
  8.     $step = $_GET['step'];
  9.  
  10.     if ($step == "setup"){
  11.     $setup = "";$step_one = "";$step_two = "";$step_three = "";$step_four = "";$step_five = "";
  12.     $step_six = "";$step_seven = "";$step_eight = "";$step_nine = "";$step_ten = "";
  13.        if(isset($_POST['submit'])){
  14.             $guide_title = trim($_POST['guide_title']);
  15.             $guide_description = trim($_POST['guide_description']);
  16.             $guide_category = trim($_POST['guide_category']);
  17.             $guide_tags = trim($_POST['guide_tags']);
  18.             $guide_ID = trim($_POST['postid']);
  19.            
  20.             if($guide_title != "" && $guide_description != "" && $guide_category != ""){
  21.  
  22.                 $current_user = wp_get_current_user();
  23.  
  24.                 $post = array(
  25.                   'post_author'    => $current_user->ID,
  26.                   'post_content'   => $guide_description,
  27.                   'post_status'    => 'pending',
  28.                   'post_title'     => $guide_title,
  29.                   'post_type'      => 'post',
  30.                   'tags_input'     => $guide_tags,
  31.                 );  
  32.  
  33.                
  34.                 $post_ID = wp_insert_post( $post, $wp_error );
  35.                 update_post_meta( $post_ID, 'post_id', $post_ID );
  36.  
  37.                 $_SESSION['postid'] = $_POST['postid'];
  38.  
  39.                 $stage_complete = true;
  40.             } else {
  41.                 $message = "<div class='alert alert-error'>Please complete all required fields.</div>";
  42.             }  
  43.         } else {
  44.             $guide_title = "";
  45.             $guide_description = "";
  46.             $guide_category = "";
  47.             $guide_tags = "";
  48.             $stage_complete = false;
  49.         }
  50.  
  51.     } else if($step == "one"){
  52.     $setup = "c";$step_one = "";$step_two = "";$step_three = "";$step_four = "";$step_five = "";
  53.     $step_six = "";$step_seven = "";$step_eight = "";$step_nine = "";$step_ten = "";
  54.  
  55.     if(isset($_POST['submit'])){
  56.  
  57.             $guide_new_title = trim($_POST['guide_new_title']);
  58.             $guide_id = trim($_POST['post_ID']);
  59.            
  60.             if($guide_new_title != "" && $guide_id != ""){
  61.  
  62.                 $post = array(
  63.                   'post_ID'        => $guide_id,
  64.                   'post_title'     => $guide_new_title,
  65.                 );  
  66.                 $my_post = array();
  67.                 $my_post['ID'] = $guide_id;
  68.                 $my_post['post_title'] = $guide_new_title;
  69.                
  70.                 wp_update_post( $my_post );
  71.  
  72.                 $stage_complete = true;
  73.             } else {
  74.                 $message = "<div class='alert alert-error'>Please complete all required fields.</div>";
  75.             }  
  76.         } else {
  77.             $guide_title = "";
  78.             $stage_complete = false;
  79.         }
  80.  
  81.     } else if($step == "two"){
  82.     $setup = "c";$step_one = "c";$step_two = "";$step_three = "";$step_four = "";$step_five = "";
  83.     $step_six = "";$step_seven = "";$step_eight = "";$step_nine = "";$step_ten = "";
  84.  
  85.     } else if($step == "three"){
  86.  
  87.     } else if($step == "four"){
  88.  
  89.     } else if($step == "five"){
  90.  
  91.     } else if($step == "six"){
  92.  
  93.     } else if($step == "seven"){
  94.  
  95.     } else if($step == "eight"){
  96.  
  97.     } else if($step == "nine"){
  98.  
  99.     } else if($step == "ten"){
  100.  
  101.     }
  102. } else {
  103.     $step = "start";
  104. }
  105.  
  106. if(empty($message)){
  107.     $message = "";
  108. }
  109. ?>
  110.  
  111. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  112.            
  113. <!-- main container -->
  114. <div class="container">
  115.  
  116.     <!-- full-width title-->
  117.     </div> <!-- close container  -->
  118.     <div class="titleBox">
  119.         <h1 class="big"><?php the_title(); ?></h1>
  120.  
  121.     </div>
  122.     <div class="container">
  123.         <div class="inner">
  124.     <!-- / full-width slider -->
  125.    
  126.             <h2><?php the_title(); ?></h2>
  127.  
  128.             <div class="entry">
  129.  
  130.                 <?php the_content(); ?>
  131.                 <?php echo $current_user->ID; ?>
  132.                 o
  133.  
  134.  
  135.  
  136.                 <?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
  137.  
  138.             <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
  139.            
  140.             </div>
  141.  
  142.         <?php endwhile; endif; ?>
  143.  
  144.    
  145. </div>
  146. </div>
  147. <!-- /  container -->
  148.  
  149. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement