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.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / classes / Post_types.php
tutor / classes Last commit date
Addons.php 7 years ago Admin.php 7 years ago Ajax.php 7 years ago Assets.php 7 years ago Course.php 7 years ago Gutenberg.php 7 years ago Instructor.php 7 years ago Instructors_List.php 7 years ago Lesson.php 7 years ago Options.php 7 years ago Post_types.php 7 years ago Q_and_A.php 7 years ago Question.php 7 years ago Question_Answers_List.php 7 years ago Quiz.php 7 years ago Quiz_Attempts_List.php 7 years ago Rewrite_Rules.php 7 years ago Shortcode.php 7 years ago Student.php 7 years ago Students_List.php 7 years ago Template.php 7 years ago Theme_Compatibility.php 7 years ago Tools.php 7 years ago Tutor_Base.php 7 years ago Tutor_List_Table.php 7 years ago User.php 7 years ago Utils.php 7 years ago Video_Stream.php 7 years ago init.php 7 years ago
Post_types.php
234 lines
1 <?php
2 namespace TUTOR;
3 if ( ! defined( 'ABSPATH' ) )
4 exit;
5
6 class Post_types{
7
8 public $course_post_type;
9 public $lesson_post_type;
10
11 public function __construct() {
12 $this->course_post_type = tutor()->course_post_type;
13 $this->lesson_post_type = tutor()->lesson_post_type;
14
15 add_action( 'init', array($this, 'register_course_post_types') );
16 add_action( 'init', array($this, 'register_lesson_post_types') );
17 add_action( 'init', array($this, 'register_quiz_post_types') );
18 }
19
20 public function register_course_post_types() {
21 $labels = array(
22 'name' => _x( 'Courses', 'post type general name', 'tutor' ),
23 'singular_name' => _x( 'Course', 'post type singular name', 'tutor' ),
24 'menu_name' => _x( 'Courses', 'admin menu', 'tutor' ),
25 'name_admin_bar' => _x( 'Course', 'add new on admin bar', 'tutor' ),
26 'add_new' => _x( 'Add New', $this->course_post_type, 'tutor' ),
27 'add_new_item' => __( 'Add New Course', 'tutor' ),
28 'new_item' => __( 'New Course', 'tutor' ),
29 'edit_item' => __( 'Edit Course', 'tutor' ),
30 'view_item' => __( 'View Course', 'tutor' ),
31 'all_items' => __( 'Courses', 'tutor' ),
32 'search_items' => __( 'Search Courses', 'tutor' ),
33 'parent_item_colon' => __( 'Parent Courses:', 'tutor' ),
34 'not_found' => __( 'No courses found.', 'tutor' ),
35 'not_found_in_trash' => __( 'No courses found in Trash.', 'tutor' )
36 );
37
38 $args = array(
39 'labels' => $labels,
40 'description' => __( 'Description.', 'tutor' ),
41 'public' => true,
42 'publicly_queryable' => true,
43 'show_ui' => true,
44 'show_in_menu' => 'tutor',
45 'query_var' => true,
46 'rewrite' => array( 'slug' => $this->course_post_type ),
47 'menu_icon' => 'dashicons-book-alt',
48 'capability_type' => 'post',
49 'has_archive' => true,
50 'hierarchical' => false,
51 'menu_position' => null,
52 'taxonomies' => array( 'course-category', 'course-tag' ),
53 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt'),
54
55 'capabilities' => array(
56 'edit_post' => 'edit_tutor_course',
57 'read_post' => 'read_tutor_course',
58 'delete_post' => 'delete_tutor_course',
59 'delete_posts' => 'delete_tutor_courses',
60 'edit_posts' => 'edit_tutor_courses',
61 'edit_others_posts' => 'edit_others_tutor_courses',
62 'publish_posts' => 'publish_tutor_courses',
63 'read_private_posts' => 'read_private_tutor_courses',
64 'create_posts' => 'edit_tutor_courses',
65 ),
66 );
67
68 register_post_type($this->course_post_type, $args);
69
70 /**
71 * Taxonomy
72 */
73 $labels = array(
74 'name' => _x( 'Categories', 'taxonomy general name', 'tutor' ),
75 'singular_name' => _x( 'Category', 'taxonomy singular name', 'tutor' ),
76 'search_items' => __( 'Search Categories', 'tutor' ),
77 'popular_items' => __( 'Popular Categories', 'tutor' ),
78 'all_items' => __( 'All Categories', 'tutor' ),
79 'parent_item' => null,
80 'parent_item_colon' => null,
81 'edit_item' => __( 'Edit Category', 'tutor' ),
82 'update_item' => __( 'Update Category', 'tutor' ),
83 'add_new_item' => __( 'Add New Category', 'tutor' ),
84 'new_item_name' => __( 'New Category Name', 'tutor' ),
85 'separate_items_with_commas' => __( 'Separate categories with commas', 'tutor' ),
86 'add_or_remove_items' => __( 'Add or remove categories', 'tutor' ),
87 'choose_from_most_used' => __( 'Choose from the most used categories', 'tutor' ),
88 'not_found' => __( 'No categories found.', 'tutor' ),
89 'menu_name' => __( 'Categories', 'tutor' ),
90 );
91
92 $args = array(
93 'hierarchical' => true,
94 'labels' => $labels,
95 'show_ui' => true,
96 'show_admin_column' => true,
97 'update_count_callback' => '_update_post_term_count',
98 'query_var' => true,
99 'rewrite' => array( 'slug' => 'course-category' ),
100 );
101
102 register_taxonomy( 'course-category', $this->course_post_type, $args );
103
104 $labels = array(
105 'name' => _x( 'Skills', 'taxonomy general name', 'tutor' ),
106 'singular_name' => _x( 'Skill', 'taxonomy singular name', 'tutor' ),
107 'search_items' => __( 'Search Skills', 'tutor' ),
108 'popular_items' => __( 'Popular Skills', 'tutor' ),
109 'all_items' => __( 'All Skills', 'tutor' ),
110 'parent_item' => null,
111 'parent_item_colon' => null,
112 'edit_item' => __( 'Edit Skill', 'tutor' ),
113 'update_item' => __( 'Update Skill', 'tutor' ),
114 'add_new_item' => __( 'Add New Skill', 'tutor' ),
115 'new_item_name' => __( 'New Skill Name', 'tutor' ),
116 'separate_items_with_commas' => __( 'Separate skills with commas', 'tutor' ),
117 'add_or_remove_items' => __( 'Add or remove skills', 'tutor' ),
118 'choose_from_most_used' => __( 'Choose from the most used skills', 'tutor' ),
119 'not_found' => __( 'No skills found.', 'tutor' ),
120 'menu_name' => __( 'Skills', 'tutor' ),
121 );
122
123 $args = array(
124 'hierarchical' => false,
125 'labels' => $labels,
126 'show_ui' => true,
127 'show_admin_column' => true,
128 'update_count_callback' => '_update_post_term_count',
129 'query_var' => true,
130 'rewrite' => array( 'slug' => 'course-tag' ),
131 );
132
133 register_taxonomy( 'course-tag', $this->course_post_type, $args );
134 }
135
136 public function register_lesson_post_types() {
137 $labels = array(
138 'name' => _x( 'Lessons', 'post type general name', 'tutor' ),
139 'singular_name' => _x( 'Lesson', 'post type singular name', 'tutor' ),
140 'menu_name' => _x( 'Lessons', 'admin menu', 'tutor' ),
141 'name_admin_bar' => _x( 'Lesson', 'add new on admin bar', 'tutor' ),
142 'add_new' => _x( 'Add New', $this->lesson_post_type, 'tutor' ),
143 'add_new_item' => __( 'Add New Lesson', 'tutor' ),
144 'new_item' => __( 'New Lesson', 'tutor' ),
145 'edit_item' => __( 'Edit Lesson', 'tutor' ),
146 'view_item' => __( 'View Lesson', 'tutor' ),
147 'all_items' => __( 'Lessons', 'tutor' ),
148 'search_items' => __( 'Search Lessons', 'tutor' ),
149 'parent_item_colon' => __( 'Parent Lessons:', 'tutor' ),
150 'not_found' => __( 'No lessons found.', 'tutor' ),
151 'not_found_in_trash' => __( 'No lessons found in Trash.', 'tutor' )
152 );
153
154 $args = array(
155 'labels' => $labels,
156 'description' => __( 'Description.', 'tutor' ),
157 'public' => true,
158 'publicly_queryable' => true,
159 'show_ui' => false,
160 'show_in_menu' => 'tutor',
161 'query_var' => true,
162 'rewrite' => array( 'slug' => $this->lesson_post_type ),
163 'menu_icon' => 'dashicons-list-view',
164 'capability_type' => 'post',
165 'has_archive' => true,
166 'hierarchical' => false,
167 'menu_position' => null,
168 'supports' => array( 'title', 'editor', 'thumbnail'),
169 'capabilities' => array(
170 'edit_post' => 'edit_tutor_lesson',
171 'read_post' => 'read_tutor_lesson',
172 'delete_post' => 'delete_tutor_lesson',
173 'delete_posts' => 'delete_tutor_lessons',
174 'edit_posts' => 'edit_tutor_lessons',
175 'edit_others_posts' => 'edit_others_tutor_lessons',
176 'publish_posts' => 'publish_tutor_lessons',
177 'read_private_posts' => 'read_private_tutor_lessons',
178 'create_posts' => 'edit_tutor_lessons',
179 ),
180 );
181
182 register_post_type( $this->lesson_post_type, $args );
183 }
184
185 public function register_quiz_post_types() {
186 $labels = array(
187 'name' => _x( 'Quizzes', 'post type general name', 'tutor' ),
188 'singular_name' => _x( 'Quiz', 'post type singular name', 'tutor' ),
189 'menu_name' => _x( 'Quizzes', 'admin menu', 'tutor' ),
190 'name_admin_bar' => _x( 'Quiz', 'add new on admin bar', 'tutor' ),
191 'add_new' => _x( 'Add New', $this->lesson_post_type, 'tutor' ),
192 'add_new_item' => __( 'Add New Quiz', 'tutor' ),
193 'new_item' => __( 'New Quiz', 'tutor' ),
194 'edit_item' => __( 'Edit Quiz', 'tutor' ),
195 'view_item' => __( 'View Quiz', 'tutor' ),
196 'all_items' => __( 'Quizzes', 'tutor' ),
197 'search_items' => __( 'Search Quizzes', 'tutor' ),
198 'parent_item_colon' => __( 'Parent Quizzes:', 'tutor' ),
199 'not_found' => __( 'No quizzes found.', 'tutor' ),
200 'not_found_in_trash' => __( 'No quizzes found in Trash.', 'tutor' )
201 );
202
203 $args = array(
204 'labels' => $labels,
205 'description' => __( 'Description.', 'tutor' ),
206 'public' => true,
207 'publicly_queryable' => true,
208 'show_ui' => false,
209 'show_in_menu' => 'tutor',
210 'query_var' => true,
211 'rewrite' => array( 'slug' => $this->lesson_post_type ),
212 'menu_icon' => 'dashicons-editor-help',
213 'capability_type' => 'post',
214 'has_archive' => true,
215 'hierarchical' => false,
216 'menu_position' => null,
217 'supports' => array( 'title', 'editor'),
218 'capabilities' => array(
219 'edit_post' => 'edit_tutor_quiz',
220 'read_post' => 'read_tutor_quiz',
221 'delete_post' => 'delete_tutor_quiz',
222 'delete_posts' => 'delete_tutor_quizzes',
223 'edit_posts' => 'edit_tutor_quizzes',
224 'edit_others_posts' => 'edit_others_tutor_quizzes',
225 'publish_posts' => 'publish_tutor_quizzes',
226 'read_private_posts' => 'read_private_tutor_quizzes',
227 'create_posts' => 'edit_tutor_quizzes',
228 ),
229 );
230
231 register_post_type( 'tutor_quiz', $args );
232 }
233
234 }