MetaBox::frontend_course_builder()


Source

File: classes/MetaBox.php

	public function frontend_course_builder(){
		global $post, $dozent_course_creation_page;

		$dozent_course_creation_page = 'frontend';

		wp_reset_query();

		$course_id = (int) dozent_input_text( 'course_id' );

		if ( $course_id ){
			$post_id = $course_id;
		}else{
			$post_id = wp_insert_post( [
				'post_title' => __( 'Auto Draft', 'dozent' ),
                'post_type' => 'dozent_course',
                'post_status' => 'auto-draft'
			] );
		}

		$post = get_post( $post_id );
		setup_postdata( $post );

		dozent_load_template( 'dashboard/my-courses/course-builder-header' );
		echo "<form action='' method='post' id='dozent-front-coursebuilder-form'>";
		dozent_nonce_field();
		do_action( 'dozent_front_coursebuilder_form_start' );
		echo "<input type='hidden' name='frontend_course_id' value='{$post_id}' />";

	    $this->course_builder();

	    do_action( 'dozent_front_coursebuilder_form_end' );
		echo "</form>";

	    wp_reset_query();
    }