Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: Post a Guide
- */
- get_header(); ?>
- <?php
- if(isset($_GET['step'])){
- $step = $_GET['step'];
- if ($step == "setup"){
- $setup = "";$step_one = "";$step_two = "";$step_three = "";$step_four = "";$step_five = "";
- $step_six = "";$step_seven = "";$step_eight = "";$step_nine = "";$step_ten = "";
- if(isset($_POST['submit'])){
- $guide_title = trim($_POST['guide_title']);
- $guide_description = trim($_POST['guide_description']);
- $guide_category = trim($_POST['guide_category']);
- $guide_tags = trim($_POST['guide_tags']);
- $guide_ID = trim($_POST['postid']);
- if($guide_title != "" && $guide_description != "" && $guide_category != ""){
- $current_user = wp_get_current_user();
- $post = array(
- 'post_author' => $current_user->ID,
- 'post_content' => $guide_description,
- 'post_status' => 'pending',
- 'post_title' => $guide_title,
- 'post_type' => 'post',
- 'tags_input' => $guide_tags,
- );
- $post_ID = wp_insert_post( $post, $wp_error );
- update_post_meta( $post_ID, 'post_id', $post_ID );
- $_SESSION['postid'] = $_POST['postid'];
- $stage_complete = true;
- } else {
- $message = "<div class='alert alert-error'>Please complete all required fields.</div>";
- }
- } else {
- $guide_title = "";
- $guide_description = "";
- $guide_category = "";
- $guide_tags = "";
- $stage_complete = false;
- }
- } else if($step == "one"){
- $setup = "c";$step_one = "";$step_two = "";$step_three = "";$step_four = "";$step_five = "";
- $step_six = "";$step_seven = "";$step_eight = "";$step_nine = "";$step_ten = "";
- if(isset($_POST['submit'])){
- $guide_new_title = trim($_POST['guide_new_title']);
- $guide_id = trim($_POST['post_ID']);
- if($guide_new_title != "" && $guide_id != ""){
- $post = array(
- 'post_ID' => $guide_id,
- 'post_title' => $guide_new_title,
- );
- $my_post = array();
- $my_post['ID'] = $guide_id;
- $my_post['post_title'] = $guide_new_title;
- wp_update_post( $my_post );
- $stage_complete = true;
- } else {
- $message = "<div class='alert alert-error'>Please complete all required fields.</div>";
- }
- } else {
- $guide_title = "";
- $stage_complete = false;
- }
- } else if($step == "two"){
- $setup = "c";$step_one = "c";$step_two = "";$step_three = "";$step_four = "";$step_five = "";
- $step_six = "";$step_seven = "";$step_eight = "";$step_nine = "";$step_ten = "";
- } else if($step == "three"){
- } else if($step == "four"){
- } else if($step == "five"){
- } else if($step == "six"){
- } else if($step == "seven"){
- } else if($step == "eight"){
- } else if($step == "nine"){
- } else if($step == "ten"){
- }
- } else {
- $step = "start";
- }
- if(empty($message)){
- $message = "";
- }
- ?>
- <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
- <!-- main container -->
- <div class="container">
- <!-- full-width title-->
- </div> <!-- close container -->
- <div class="titleBox">
- <h1 class="big"><?php the_title(); ?></h1>
- </div>
- <div class="container">
- <div class="inner">
- <!-- / full-width slider -->
- <h2><?php the_title(); ?></h2>
- <div class="entry">
- <?php the_content(); ?>
- <?php echo $current_user->ID; ?>
- o
- <?php wp_link_pages(array('before' => 'Pages: ', 'next_or_number' => 'number')); ?>
- <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
- </div>
- <?php endwhile; endif; ?>
- </div>
- </div>
- <!-- / container -->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement