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.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.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
283 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 //add_action( 'init', array($this, 'register_quiz_question_post_types') );
19 }
20
21 public function register_course_post_types() {
22 $labels = array(
23 'name' => _x( 'Courses', 'post type general name', 'tutor' ),
24 'singular_name' => _x( 'Course', 'post type singular name', 'tutor' ),
25 'menu_name' => _x( 'Courses', 'admin menu', 'tutor' ),
26 'name_admin_bar' => _x( 'Course', 'add new on admin bar', 'tutor' ),
27 'add_new' => _x( 'Add New', $this->course_post_type, 'tutor' ),
28 'add_new_item' => __( 'Add New Course', 'tutor' ),
29 'new_item' => __( 'New Course', 'tutor' ),
30 'edit_item' => __( 'Edit Course', 'tutor' ),
31 'view_item' => __( 'View Course', 'tutor' ),
32 'all_items' => __( 'Courses', 'tutor' ),
33 'search_items' => __( 'Search Courses', 'tutor' ),
34 'parent_item_colon' => __( 'Parent Courses:', 'tutor' ),
35 'not_found' => __( 'No courses found.', 'tutor' ),
36 'not_found_in_trash' => __( 'No courses found in Trash.', 'tutor' )
37 );
38
39 $args = array(
40 'labels' => $labels,
41 'description' => __( 'Description.', 'tutor' ),
42 'public' => true,
43 'publicly_queryable' => true,
44 'show_ui' => true,
45 'show_in_menu' => 'tutor',
46 'query_var' => true,
47 'rewrite' => array( 'slug' => $this->course_post_type ),
48 'menu_icon' => 'dashicons-book-alt',
49 'capability_type' => 'post',
50 'has_archive' => true,
51 'hierarchical' => false,
52 'menu_position' => null,
53 'taxonomies' => array( 'course-category', 'course-tag' ),
54 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt'),
55
56 'capabilities' => array(
57 'edit_post' => 'edit_tutor_course',
58 'read_post' => 'read_tutor_course',
59 'delete_post' => 'delete_tutor_course',
60 'delete_posts' => 'delete_tutor_courses',
61 'edit_posts' => 'edit_tutor_courses',
62 'edit_others_posts' => 'edit_others_tutor_courses',
63 'publish_posts' => 'publish_tutor_courses',
64 'read_private_posts' => 'read_private_tutor_courses',
65 'create_posts' => 'edit_tutor_courses',
66 ),
67 );
68
69 register_post_type($this->course_post_type, $args);
70
71 /**
72 * Taxonomy
73 */
74 $labels = array(
75 'name' => _x( 'Categories', 'taxonomy general name', 'tutor' ),
76 'singular_name' => _x( 'Category', 'taxonomy singular name', 'tutor' ),
77 'search_items' => __( 'Search Categories', 'tutor' ),
78 'popular_items' => __( 'Popular Categories', 'tutor' ),
79 'all_items' => __( 'All Categories', 'tutor' ),
80 'parent_item' => null,
81 'parent_item_colon' => null,
82 'edit_item' => __( 'Edit Category', 'tutor' ),
83 'update_item' => __( 'Update Category', 'tutor' ),
84 'add_new_item' => __( 'Add New Category', 'tutor' ),
85 'new_item_name' => __( 'New Category Name', 'tutor' ),
86 'separate_items_with_commas' => __( 'Separate categories with commas', 'tutor' ),
87 'add_or_remove_items' => __( 'Add or remove categories', 'tutor' ),
88 'choose_from_most_used' => __( 'Choose from the most used categories', 'tutor' ),
89 'not_found' => __( 'No categories found.', 'tutor' ),
90 'menu_name' => __( 'Categories', 'tutor' ),
91 );
92
93 $args = array(
94 'hierarchical' => true,
95 'labels' => $labels,
96 'show_ui' => true,
97 'show_admin_column' => true,
98 'update_count_callback' => '_update_post_term_count',
99 'query_var' => true,
100 'rewrite' => array( 'slug' => 'course-category' ),
101 );
102
103 register_taxonomy( 'course-category', $this->course_post_type, $args );
104
105 $labels = array(
106 'name' => _x( 'Tags', 'taxonomy general name', 'tutor' ),
107 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'tutor' ),
108 'search_items' => __( 'Search Tags', 'tutor' ),
109 'popular_items' => __( 'Popular Tags', 'tutor' ),
110 'all_items' => __( 'All Tags', 'tutor' ),
111 'parent_item' => null,
112 'parent_item_colon' => null,
113 'edit_item' => __( 'Edit Tag', 'tutor' ),
114 'update_item' => __( 'Update Tag', 'tutor' ),
115 'add_new_item' => __( 'Add New Tag', 'tutor' ),
116 'new_item_name' => __( 'New Tag Name', 'tutor' ),
117 'separate_items_with_commas' => __( 'Separate tags with commas', 'tutor' ),
118 'add_or_remove_items' => __( 'Add or remove tags', 'tutor' ),
119 'choose_from_most_used' => __( 'Choose from the most used tags', 'tutor' ),
120 'not_found' => __( 'No tags found.', 'tutor' ),
121 'menu_name' => __( 'Tags', 'tutor' ),
122 );
123
124 $args = array(
125 'hierarchical' => false,
126 'labels' => $labels,
127 'show_ui' => true,
128 'show_admin_column' => true,
129 'update_count_callback' => '_update_post_term_count',
130 'query_var' => true,
131 'rewrite' => array( 'slug' => 'course-tag' ),
132 );
133
134 register_taxonomy( 'course-tag', $this->course_post_type, $args );
135 }
136
137 public function register_lesson_post_types() {
138 $labels = array(
139 'name' => _x( 'Lessons', 'post type general name', 'tutor' ),
140 'singular_name' => _x( 'Lesson', 'post type singular name', 'tutor' ),
141 'menu_name' => _x( 'Lessons', 'admin menu', 'tutor' ),
142 'name_admin_bar' => _x( 'Lesson', 'add new on admin bar', 'tutor' ),
143 'add_new' => _x( 'Add New', $this->lesson_post_type, 'tutor' ),
144 'add_new_item' => __( 'Add New Lesson', 'tutor' ),
145 'new_item' => __( 'New Lesson', 'tutor' ),
146 'edit_item' => __( 'Edit Lesson', 'tutor' ),
147 'view_item' => __( 'View Lesson', 'tutor' ),
148 'all_items' => __( 'Lessons', 'tutor' ),
149 'search_items' => __( 'Search Lessons', 'tutor' ),
150 'parent_item_colon' => __( 'Parent Lessons:', 'tutor' ),
151 'not_found' => __( 'No lessons found.', 'tutor' ),
152 'not_found_in_trash' => __( 'No lessons found in Trash.', 'tutor' )
153 );
154
155 $args = array(
156 'labels' => $labels,
157 'description' => __( 'Description.', 'tutor' ),
158 'public' => true,
159 'publicly_queryable' => true,
160 'show_ui' => true,
161 'show_in_menu' => 'tutor',
162 'query_var' => true,
163 'rewrite' => array( 'slug' => $this->lesson_post_type ),
164 'menu_icon' => 'dashicons-list-view',
165 'capability_type' => 'post',
166 'has_archive' => true,
167 'hierarchical' => false,
168 'menu_position' => null,
169 'supports' => array( 'title', 'editor', 'thumbnail'),
170 'capabilities' => array(
171 'edit_post' => 'edit_tutor_lesson',
172 'read_post' => 'read_tutor_lesson',
173 'delete_post' => 'delete_tutor_lesson',
174 'delete_posts' => 'delete_tutor_lessons',
175 'edit_posts' => 'edit_tutor_lessons',
176 'edit_others_posts' => 'edit_others_tutor_lessons',
177 'publish_posts' => 'publish_tutor_lessons',
178 'read_private_posts' => 'read_private_tutor_lessons',
179 'create_posts' => 'edit_tutor_lessons',
180 ),
181 );
182
183 register_post_type( $this->lesson_post_type, $args );
184 }
185
186 public function register_quiz_post_types() {
187 $labels = array(
188 'name' => _x( 'Quizzes', 'post type general name', 'tutor' ),
189 'singular_name' => _x( 'Quiz', 'post type singular name', 'tutor' ),
190 'menu_name' => _x( 'Quizzes', 'admin menu', 'tutor' ),
191 'name_admin_bar' => _x( 'Quiz', 'add new on admin bar', 'tutor' ),
192 'add_new' => _x( 'Add New', $this->lesson_post_type, 'tutor' ),
193 'add_new_item' => __( 'Add New Quiz', 'tutor' ),
194 'new_item' => __( 'New Quiz', 'tutor' ),
195 'edit_item' => __( 'Edit Quiz', 'tutor' ),
196 'view_item' => __( 'View Quiz', 'tutor' ),
197 'all_items' => __( 'Quizzes', 'tutor' ),
198 'search_items' => __( 'Search Quizzes', 'tutor' ),
199 'parent_item_colon' => __( 'Parent Quizzes:', 'tutor' ),
200 'not_found' => __( 'No quizzes found.', 'tutor' ),
201 'not_found_in_trash' => __( 'No quizzes found in Trash.', 'tutor' )
202 );
203
204 $args = array(
205 'labels' => $labels,
206 'description' => __( 'Description.', 'tutor' ),
207 'public' => true,
208 'publicly_queryable' => true,
209 'show_ui' => true,
210 'show_in_menu' => 'tutor',
211 'query_var' => true,
212 'rewrite' => array( 'slug' => $this->lesson_post_type ),
213 'menu_icon' => 'dashicons-editor-help',
214 'capability_type' => 'post',
215 'has_archive' => true,
216 'hierarchical' => false,
217 'menu_position' => null,
218 'supports' => array( 'title', 'editor'),
219 'capabilities' => array(
220 'edit_post' => 'edit_tutor_quiz',
221 'read_post' => 'read_tutor_quiz',
222 'delete_post' => 'delete_tutor_quiz',
223 'delete_posts' => 'delete_tutor_quizzes',
224 'edit_posts' => 'edit_tutor_quizzes',
225 'edit_others_posts' => 'edit_others_tutor_quizzes',
226 'publish_posts' => 'publish_tutor_quizzes',
227 'read_private_posts' => 'read_private_tutor_quizzes',
228 'create_posts' => 'edit_tutor_quizzes',
229 ),
230 );
231
232 register_post_type( 'tutor_quiz', $args );
233 }
234
235 public function register_quiz_question_post_types() {
236 $labels = array(
237 'name' => _x( 'Questions', 'post type general name', 'tutor' ),
238 'singular_name' => _x( 'Question', 'post type singular name', 'tutor' ),
239 'menu_name' => _x( 'Questions', 'admin menu', 'tutor' ),
240 'name_admin_bar' => _x( 'Question', 'add new on admin bar', 'tutor' ),
241 'add_new' => _x( 'Add New', $this->lesson_post_type, 'tutor' ),
242 'add_new_item' => __( 'Add New Question', 'tutor' ),
243 'new_item' => __( 'New Question', 'tutor' ),
244 'edit_item' => __( 'Edit Question', 'tutor' ),
245 'view_item' => __( 'View Question', 'tutor' ),
246 'all_items' => __( 'Questions', 'tutor' ),
247 'search_items' => __( 'Search Questions', 'tutor' ),
248 'parent_item_colon' => __( 'Parent Questions:', 'tutor' ),
249 'not_found' => __( 'No questions found.', 'tutor' ),
250 'not_found_in_trash' => __( 'No questions found in Trash.', 'tutor' )
251 );
252
253 $args = array(
254 'labels' => $labels,
255 'description' => __( 'Description.', 'tutor' ),
256 'public' => true,
257 'publicly_queryable' => true,
258 'show_ui' => true,
259 'show_in_menu' => 'tutor',
260 'query_var' => true,
261 'rewrite' => array( 'slug' => $this->lesson_post_type ),
262 'menu_icon' => 'dashicons-editor-help',
263 'capability_type' => 'post',
264 'has_archive' => true,
265 'hierarchical' => false,
266 'menu_position' => null,
267 'supports' => array( ''),
268 'capabilities' => array(
269 'edit_post' => 'edit_tutor_question',
270 'read_post' => 'read_tutor_question',
271 'delete_post' => 'delete_tutor_question',
272 'delete_posts' => 'delete_tutor_questions',
273 'edit_posts' => 'edit_tutor_questions',
274 'edit_others_posts' => 'edit_others_tutor_questions',
275 'publish_posts' => 'publish_tutor_questions',
276 'read_private_posts' => 'read_private_tutor_questions',
277 'create_posts' => 'edit_tutor_questions',
278 ),
279 );
280
281 register_post_type( 'tutor_question', $args );
282 }
283 }