PostType::register_quiz_post_type()


Source

File: classes/PostType.php

	public function register_quiz_post_type(){
		$quiz_slug = dozent_get_option('quiz_base_slug', 'quiz');
		$quiz_base_slug = apply_filters('dozent_quiz_base_slug', $quiz_slug);

		$labels = array(
			'name'               => _x( 'Quizzes', 'post type general name', 'dozent' ),
			'singular_name'      => _x( 'Quiz', 'post type singular name', 'dozent' ),
			'menu_name'          => _x( 'Quizzes', 'admin menu', 'dozent' ),
			'name_admin_bar'     => _x( 'Quiz', 'add new on admin bar', 'dozent' ),
			'add_new'            => _x( 'Add New', $quiz_base_slug, 'dozent' ),
			'add_new_item'       => __( 'Add New Quiz', 'dozent' ),
			'new_item'           => __( 'New Quiz', 'dozent' ),
			'edit_item'          => __( 'Edit Quiz', 'dozent' ),
			'view_item'          => __( 'View Quiz', 'dozent' ),
			'all_items'          => __( 'Quizzes', 'dozent' ),
			'search_items'       => __( 'Search Quizzes', 'dozent' ),
			'parent_item_colon'  => __( 'Parent Quizzes:', 'dozent' ),
			'not_found'          => __( 'No quizs found.', 'dozent' ),
			'not_found_in_trash' => __( 'No quizs found in Trash.', 'dozent' )
		);

		$args = array(
			'labels'                => $labels,
			'description'           => __( 'Description.', 'dozent' ),
			'public'                => true,
			'publicly_queryable'    => true,
			'show_ui'               => true,
			'show_in_menu'          => false,
			'query_var'             => true,
			'rewrite'               => array( 'slug' => $quiz_base_slug ),
			'menu_icon'             => 'dashicons-list-view',
			'capability_type'       => 'post',
			'has_archive'           => true,
			'hierarchical'          => false,
			'menu_position'         => null,
			'supports'              => array( 'title', 'editor'),
			'show_in_rest'          => true,
			'capabilities'      => $this->course_capabilities,
		);

		register_post_type('dozent_quiz', $args );
	}