LLMS_Post_Types::register_post_types()

Register Post Types.


Return Return

(void)


Top ↑

Source Source

File: includes/class.llms.post-types.php

	public static function register_post_types() {

		// Course.
		$catalog_id = llms_get_page_id( 'shop' );
		self::register_post_type(
			'course',
			array(
				'labels'              => array(
					'name'               => __( 'Courses', 'lifterlms' ),
					'singular_name'      => __( 'Course', 'lifterlms' ),
					'menu_name'          => _x( 'Courses', 'Admin menu name', 'lifterlms' ),
					'add_new'            => __( 'Add Course', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Course', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Course', 'lifterlms' ),
					'new_item'           => __( 'New Course', 'lifterlms' ),
					'view'               => __( 'View Course', 'lifterlms' ),
					'view_item'          => __( 'View Course', 'lifterlms' ),
					'search_items'       => __( 'Search Courses', 'lifterlms' ),
					'not_found'          => __( 'No Courses found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Courses found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Course', 'lifterlms' ),
				),
				'public'              => true,
				'show_ui'             => true,
				'menu_icon'           => 'dashicons-welcome-learn-more',
				'capabilities'        => self::get_post_type_caps( 'course' ),
				'map_meta_cap'        => true,
				'publicly_queryable'  => true,
				'exclude_from_search' => false,
				'hierarchical'        => false,
				'rewrite'             => array(
					'slug'       => _x( 'course', 'course url slug', 'lifterlms' ),
					'with_front' => false,
					'feeds'      => true,
				),
				'query_var'           => true,
				'supports'            => array( 'title', 'author', 'editor', 'thumbnail', 'comments', 'custom-fields', 'page-attributes', 'revisions', 'llms-clone-post', 'llms-export-post', 'llms-sales-page' ),
				'has_archive'         => ( $catalog_id && get_post( $catalog_id ) ) ? get_page_uri( $catalog_id ) : _x( 'courses', 'course archive url slug', 'lifterlms' ),
				'show_in_nav_menus'   => true,
				'menu_position'       => 52,
			)
		);

		// Section.
		self::register_post_type(
			'section',
			array(
				'labels'              => array(
					'name'               => __( 'Sections', 'lifterlms' ),
					'singular_name'      => __( 'Section', 'lifterlms' ),
					'add_new'            => __( 'Add Section', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Section', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Section', 'lifterlms' ),
					'new_item'           => __( 'New Section', 'lifterlms' ),
					'view'               => __( 'View Section', 'lifterlms' ),
					'view_item'          => __( 'View Section', 'lifterlms' ),
					'search_items'       => __( 'Search Sections', 'lifterlms' ),
					'not_found'          => __( 'No Sections found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Sections found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Sections', 'lifterlms' ),
					'menu_name'          => _x( 'Sections', 'Admin menu name', 'lifterlms' ),
				),
				'public'              => false,
				'show_ui'             => false,
				'map_meta_cap'        => true,
				'publicly_queryable'  => false,
				'exclude_from_search' => true,
				'hierarchical'        => false,
				'show_in_nav_menus'   => false,
				'rewrite'             => false,
				'query_var'           => false,
				'supports'            => array( 'title' ),
				'has_archive'         => false,
			)
		);

		// Lesson.
		self::register_post_type(
			'lesson',
			array(
				'labels'              => array(
					'name'               => __( 'Lessons', 'lifterlms' ),
					'singular_name'      => __( 'Lesson', 'lifterlms' ),
					'add_new'            => __( 'Add Lesson', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Lesson', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Lesson', 'lifterlms' ),
					'new_item'           => __( 'New Lesson', 'lifterlms' ),
					'view'               => __( 'View Lesson', 'lifterlms' ),
					'view_item'          => __( 'View Lesson', 'lifterlms' ),
					'search_items'       => __( 'Search Lessons', 'lifterlms' ),
					'not_found'          => __( 'No Lessons found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Lessons found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Lessons', 'lifterlms' ),
					'menu_name'          => _x( 'Lessons', 'Admin menu name', 'lifterlms' ),
				),
				'public'              => true,
				'show_ui'             => true,
				'capabilities'        => self::get_post_type_caps( 'lesson' ),
				'map_meta_cap'        => true,
				'publicly_queryable'  => true,
				'exclude_from_search' => true,
				'show_in_menu'        => 'edit.php?post_type=course',
				'hierarchical'        => false,
				'rewrite'             => array(
					'slug'       => _x( 'lesson', 'lesson url slug', 'lifterlms' ),
					'with_front' => false,
					'feeds'      => true,
				),
				'show_in_nav_menus'   => false,
				'query_var'           => true,
				'supports'            => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields', 'page-attributes', 'revisions', 'author', 'llms-clone-post' ),
			)
		);

		// Quiz.
		self::register_post_type(
			'llms_quiz',
			array(
				'labels'              => array(
					'name'               => __( 'Quizzes', 'lifterlms' ),
					'singular_name'      => __( 'Quiz', 'lifterlms' ),
					'add_new'            => __( 'Add Quiz', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Quiz', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Quiz', 'lifterlms' ),
					'new_item'           => __( 'New Quiz', 'lifterlms' ),
					'view'               => __( 'View Quiz', 'lifterlms' ),
					'view_item'          => __( 'View Quiz', 'lifterlms' ),
					'search_items'       => __( 'Search Quiz', 'lifterlms' ),
					'not_found'          => __( 'No Quizzes found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Quizzes found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Quizzes', 'lifterlms' ),
					'menu_name'          => _x( 'Quizzes', 'Admin menu name', 'lifterlms' ),
				),
				'public'              => true,
				'show_ui'             => false,
				'map_meta_cap'        => true,
				'capabilities'        => self::get_post_type_caps( array( 'quiz', 'quizzes' ) ),
				'publicly_queryable'  => true,
				'exclude_from_search' => true,
				'show_in_menu'        => 'edit.php?post_type=course',
				'hierarchical'        => false,
				'rewrite'             => array(
					'slug'       => _x( 'quiz', 'quiz url slug', 'lifterlms' ),
					'with_front' => false,
					'feeds'      => true,
				),
				'show_in_nav_menus'   => false,
				'query_var'           => true,
				'supports'            => array( 'title', 'editor', 'author', 'custom-fields' ),
			)
		);

		// Quiz Question.
		self::register_post_type(
			'llms_question',
			array(
				'labels'              => array(
					'name'               => __( 'Questions', 'lifterlms' ),
					'singular_name'      => __( 'Question', 'lifterlms' ),
					'add_new'            => __( 'Add Question', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Question', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Question', 'lifterlms' ),
					'new_item'           => __( 'New Question', 'lifterlms' ),
					'view'               => __( 'View Question', 'lifterlms' ),
					'view_item'          => __( 'View Question', 'lifterlms' ),
					'search_items'       => __( 'Search Questions', 'lifterlms' ),
					'not_found'          => __( 'No Questions found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Questions found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Questions', 'lifterlms' ),
					'menu_name'          => _x( 'Quiz Questions', 'Admin menu name', 'lifterlms' ),
				),
				'public'              => false,
				'show_ui'             => false,
				'map_meta_cap'        => true,
				'capabilities'        => self::get_post_type_caps( 'question' ),
				'publicly_queryable'  => false,
				'exclude_from_search' => true,
				'show_in_menu'        => 'edit.php?post_type=course',
				'hierarchical'        => false,
				'rewrite'             => false,
				'show_in_nav_menus'   => false,
				'query_var'           => false,
				'supports'            => array( 'title', 'editor' ),
			)
		);

		// Membership.
		$membership_page_id = llms_get_page_id( 'memberships' );
		self::register_post_type(
			'llms_membership',
			array(
				'labels'              => array(
					'name'               => __( 'Memberships', 'lifterlms' ),
					'singular_name'      => __( 'Membership', 'lifterlms' ),
					'menu_name'          => _x( 'Memberships', 'Admin menu name', 'lifterlms' ),
					'add_new'            => __( 'Add Membership', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Membership', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Membership', 'lifterlms' ),
					'new_item'           => __( 'New Membership', 'lifterlms' ),
					'view'               => __( 'View Membership', 'lifterlms' ),
					'view_item'          => __( 'View Membership', 'lifterlms' ),
					'search_items'       => __( 'Search Memberships', 'lifterlms' ),
					'not_found'          => __( 'No Memberships found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Memberships found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Membership', 'lifterlms' ),
				),
				'public'              => true,
				'show_ui'             => true,
				'capabilities'        => self::get_post_type_caps( 'membership' ),
				'map_meta_cap'        => true,
				'menu_icon'           => 'dashicons-groups',
				'publicly_queryable'  => true,
				'exclude_from_search' => false,
				'show_in_menu'        => true,
				'hierarchical'        => false,
				'rewrite'             => array(
					'slug'       => _x( 'membership', 'membership url slug', 'lifterlms' ),
					'with_front' => false,
					'feeds'      => true,
				),
				'query_var'           => true,
				'supports'            => array( 'title', 'editor', 'thumbnail', 'comments', 'custom-fields', 'page-attributes', 'revisions', 'llms-sales-page' ),
				'has_archive'         => ( $membership_page_id && get_post( $membership_page_id ) ) ? get_page_uri( $membership_page_id ) : _x( 'memberships', 'membership archive url slug', 'lifterlms' ),
				'show_in_nav_menus'   => true,
				'menu_position'       => 52,
			)
		);

		// Engagement.
		self::register_post_type(
			'llms_engagement',
			array(
				'labels'              => array(
					'name'               => __( 'Engagements', 'lifterlms' ),
					'singular_name'      => __( 'Engagement', 'lifterlms' ),
					'add_new'            => __( 'Add Engagement', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Engagement', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Engagement', 'lifterlms' ),
					'new_item'           => __( 'New Engagement', 'lifterlms' ),
					'view'               => __( 'View Engagement', 'lifterlms' ),
					'view_item'          => __( 'View Engagement', 'lifterlms' ),
					'search_items'       => __( 'Search Engagement', 'lifterlms' ),
					'not_found'          => __( 'No Engagement found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Engagement found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Engagement', 'lifterlms' ),
					'menu_name'          => _x( 'Engagements', 'Admin menu name', 'lifterlms' ),
				),
				'public'              => false,
				'show_ui'             => ( current_user_can( apply_filters( 'lifterlms_admin_engagements_access', 'manage_lifterlms' ) ) ) ? true : false,
				'map_meta_cap'        => true,
				'publicly_queryable'  => false,
				'exclude_from_search' => true,
				'menu_position'       => 52,
				'menu_icon'           => 'dashicons-awards',
				'hierarchical'        => false,
				'show_in_nav_menus'   => false,
				'rewrite'             => false,
				'query_var'           => false,
				'supports'            => array( 'title' ),
				'has_archive'         => false,
			)
		);

		// Order.
		self::register_post_type(
			'llms_order',
			array(
				'labels'              => array(
					'name'               => __( 'Orders', 'lifterlms' ),
					'singular_name'      => __( 'Order', 'lifterlms' ),
					'add_new'            => __( 'Add Order', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Order', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Order', 'lifterlms' ),
					'new_item'           => __( 'New Order', 'lifterlms' ),
					'view'               => __( 'View Order', 'lifterlms' ),
					'view_item'          => __( 'View Order', 'lifterlms' ),
					'search_items'       => __( 'Search Orders', 'lifterlms' ),
					'not_found'          => __( 'No Orders found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Orders found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Orders', 'lifterlms' ),
					'menu_name'          => _x( 'Orders', 'Admin menu name', 'lifterlms' ),
				),
				'public'              => false,
				'show_ui'             => ( current_user_can( apply_filters( 'lifterlms_admin_order_access', 'manage_lifterlms' ) ) ) ? true : false,
				'map_meta_cap'        => true,
				'publicly_queryable'  => false,
				'menu_icon'           => 'dashicons-cart',
				'menu_position'       => 52,
				'exclude_from_search' => true,
				'hierarchical'        => false,
				'show_in_nav_menus'   => false,
				'rewrite'             => false,
				'query_var'           => false,
				'supports'            => array( 'title', 'comments', 'custom-fields' ),
				'has_archive'         => false,
				'capabilities'        => array(
					'create_posts' => 'do_not_allow',
				),
			)
		);

		// Transaction.
		self::register_post_type(
			'llms_transaction',
			array(
				'labels'              => array(
					'name'               => __( 'Transactions', 'lifterlms' ),
					'singular_name'      => __( 'Transaction', 'lifterlms' ),
					'add_new'            => __( 'Add Transaction', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Transaction', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Transaction', 'lifterlms' ),
					'new_item'           => __( 'New Transaction', 'lifterlms' ),
					'view'               => __( 'View Transaction', 'lifterlms' ),
					'view_item'          => __( 'View Transaction', 'lifterlms' ),
					'search_items'       => __( 'Search Transactions', 'lifterlms' ),
					'not_found'          => __( 'No Transactions found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Transactions found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Transactions', 'lifterlms' ),
					'menu_name'          => _x( 'Orders', 'Admin menu name', 'lifterlms' ),
				),
				'public'              => false,
				'show_ui'             => false,
				'map_meta_cap'        => true,
				'publicly_queryable'  => false,
				'exclude_from_search' => true,
				'show_in_menu'        => false,
				'hierarchical'        => false,
				'show_in_nav_menus'   => false,
				'rewrite'             => false,
				'query_var'           => false,
				'supports'            => array( '' ),
				'has_archive'         => false,
				'capabilities'        => array(
					'create_posts' => 'do_not_allow',
				),
			)
		);

		// Achievement.
		self::register_post_type(
			'llms_achievement',
			array(
				'labels'              => array(
					'name'                  => __( 'Achievement Templates', 'lifterlms' ),
					'singular_name'         => __( 'Achievement Template', 'lifterlms' ),
					'add_new'               => __( 'Add Achievement Template', 'lifterlms' ),
					'add_new_item'          => __( 'Add New Achievement Template', 'lifterlms' ),
					'edit'                  => __( 'Edit', 'lifterlms' ),
					'edit_item'             => __( 'Edit Achievement Template', 'lifterlms' ),
					'new_item'              => __( 'New Achievement Template', 'lifterlms' ),
					'view'                  => __( 'View Achievement Template', 'lifterlms' ),
					'view_item'             => __( 'View Achievement Template', 'lifterlms' ),
					'search_items'          => __( 'Search Achievement Templates', 'lifterlms' ),
					'not_found'             => __( 'No Achievement Templates found', 'lifterlms' ),
					'not_found_in_trash'    => __( 'No Achievement Templates found in trash', 'lifterlms' ),
					'parent'                => __( 'Parent Achievement Template', 'lifterlms' ),
					'menu_name'             => _x( 'Achievements', 'Admin menu name', 'lifterlms' ),
					'featured_image'        => __( 'Achievement Image', 'lifterlms' ),
					'set_featured_image'    => __( 'Set achievement  image', 'lifterlms' ),
					'remove_featured_image' => __( 'Remove achievement image', 'lifterlms' ),
					'use_featured_image'    => __( 'Use achievement image', 'lifterlms' ),
				),
				'public'              => false,
				'show_ui'             => ( current_user_can( apply_filters( 'lifterlms_admin_achievements_access', 'manage_lifterlms' ) ) ) ? true : false,
				'map_meta_cap'        => true,
				'publicly_queryable'  => false,
				'exclude_from_search' => true,
				'show_in_menu'        => 'edit.php?post_type=llms_engagement',
				'hierarchical'        => false,
				'show_in_nav_menus'   => false,
				'rewrite'             => false,
				'query_var'           => false,
				'supports'            => array( 'title', 'thumbnail' ),
				'has_archive'         => false,
			)
		);

		// Earned achievements.
		self::register_post_type(
			'llms_my_achievement',
			array(
				'labels'              => array(
					'name'                  => __( 'Awarded Achievements', 'lifterlms' ),
					'singular_name'         => __( 'Awarded Achievement', 'lifterlms' ),
					'add_new'               => __( 'Award Achievement', 'lifterlms' ),
					'add_new_item'          => __( 'Award New Achievement', 'lifterlms' ),
					'edit'                  => __( 'Edit', 'lifterlms' ),
					'edit_item'             => __( 'Edit Awarded Achievement', 'lifterlms' ),
					'new_item'              => __( 'New Awarded Achievement', 'lifterlms' ),
					'view'                  => __( 'View Awarded Achievement', 'lifterlms' ),
					'view_item'             => __( 'View Awarded Achievement', 'lifterlms' ),
					'search_items'          => __( 'Search Awarded Achievements', 'lifterlms' ),
					'not_found'             => __( 'No Awarded Achievements found', 'lifterlms' ),
					'not_found_in_trash'    => __( 'No Awarded Achievements found in trash', 'lifterlms' ),
					'parent'                => __( 'Parent Awarded Achievements', 'lifterlms' ),
					'menu_name'             => _x( 'Awarded Achievements', 'Admin menu name', 'lifterlms' ),
					'featured_image'        => __( 'Achievement Image', 'lifterlms' ),
					'set_featured_image'    => __( 'Set awarded achievement image', 'lifterlms' ),
					'remove_featured_image' => __( 'Remove awarded achievement image', 'lifterlms' ),
					'use_featured_image'    => __( 'Use awarded achievement image', 'lifterlms' ),
				),
				'description'         => __( 'This is where you can view all of the awarded achievements.', 'lifterlms' ),
				'public'              => false,
				/**
				 * Filters the needed capability to generate and allow a UI for managing `llms_my_achievement` post type in the admin.
				 *
				 * @since 6.0.0
				 *
				 * @param bool $show_ui The needed capability to generate and allow a UI for managing `llms_my_achievement` post type in the admin.
				 *                      Default is `manage_earned_engagements`.
				 */
				'show_ui'             => ( current_user_can( apply_filters( 'lifterlms_admin_my_achievements_access', LLMS_Roles::MANAGE_EARNED_ENGAGEMENT_CAP ) ) ) ? true : false,
				'capabilities'        => self::get_post_type_caps( 'my_achievement' ),
				'map_meta_cap'        => false,
				'publicly_queryable'  => false,
				'exclude_from_search' => true,
				/** This filter is documented above. */
				'show_in_menu'        => ( current_user_can( apply_filters( 'lifterlms_admin_my_achievements_access', LLMS_Roles::MANAGE_EARNED_ENGAGEMENT_CAP ) ) ) ? 'edit.php?post_type=llms_engagement' : false,
				'hierarchical'        => false,
				'rewrite'             => false,
				'show_in_nav_menus'   => false,
				'has_archive'         => false,
				'query_var'           => false,
				'supports'            => array( 'title', 'thumbnail' ),
			)
		);

		// Certificate.
		self::register_certificate_post_type(
			'llms_certificate',
			array(
				'name'               => __( 'Certificate Templates', 'lifterlms' ),
				'singular_name'      => __( 'Certificate Template', 'lifterlms' ),
				'add_new'            => __( 'Add Certificate Template', 'lifterlms' ),
				'add_new_item'       => __( 'Add New Certificate Template', 'lifterlms' ),
				'edit_item'          => __( 'Edit Certificate Template', 'lifterlms' ),
				'new_item'           => __( 'New Certificate Template', 'lifterlms' ),
				'view'               => __( 'View Certificate Template', 'lifterlms' ),
				'view_item'          => __( 'View Certificate Template', 'lifterlms' ),
				'search_items'       => __( 'Search Certificate Templates', 'lifterlms' ),
				'not_found'          => __( 'No Certificate Templates found', 'lifterlms' ),
				'not_found_in_trash' => __( 'No Certificate Templates found in trash', 'lifterlms' ),
				'parent'             => __( 'Parent Certificate Templates', 'lifterlms' ),
				'menu_name'          => _x( 'Certificates', 'Admin menu name', 'lifterlms' ),
			),
			array(
				'map_meta_cap' => true,
			),
			_x( 'certificate-template', 'slug', 'lifterlms' ),
			/**
			 * Filters the WordPress user capability required for a user to manage certificate templates on the admin panel.
			 *
			 * @since Unknown
			 *
			 * @param string $capability User capability. Default: `manage_lifterlms`.
			 */
			apply_filters( 'lifterlms_admin_certificates_access', 'manage_lifterlms' )
		);

		// Earned certificate.
		self::register_certificate_post_type(
			'llms_my_certificate',
			array(
				'name'               => __( 'Awarded Certificates', 'lifterlms' ),
				'singular_name'      => __( 'Awarded Certificate', 'lifterlms' ),
				'add_new'            => __( 'Award Certificate', 'lifterlms' ),
				'add_new_item'       => __( 'Award New Certificate', 'lifterlms' ),
				'edit_item'          => __( 'Edit Awarded Certificate', 'lifterlms' ),
				'new_item'           => __( 'New Awarded Certificate', 'lifterlms' ),
				'view'               => __( 'View Awarded Certificate', 'lifterlms' ),
				'view_item'          => __( 'View Awarded Certificate', 'lifterlms' ),
				'search_items'       => __( 'Search Awarded Certificates', 'lifterlms' ),
				'not_found'          => __( 'No Awarded Certificates found', 'lifterlms' ),
				'not_found_in_trash' => __( 'No Awarded Certificates found in trash', 'lifterlms' ),
				'parent'             => __( 'Parent Awarded Certificates', 'lifterlms' ),
				'menu_name'          => _x( 'Awarded Certificates', 'Admin menu name', 'lifterlms' ),
			),
			array(
				'capabilities' => self::get_post_type_caps( 'my_certificate' ),
				'map_meta_cap' => false,
			),
			_x( 'certificate', 'slug', 'lifterlms' ),
			/**
			 * Filters the needed capability to generate and allow a UI for managing `llms_my_certificate` post type in the admin.
			 *
			 * @since 6.0.0
			 *
			 * @param bool $show_ui The needed capability to generate and allow a UI for managing `llms_my_certificate` post type in the admin.
			 *                      Default is `manage_earned_engagements`.
			 */
			apply_filters( 'lifterlms_admin_my_certificates_access', LLMS_Roles::MANAGE_EARNED_ENGAGEMENT_CAP )
		);

		// Email.
		self::register_post_type(
			'llms_email',
			array(
				'labels'              => array(
					'name'               => __( 'Email Templates', 'lifterlms' ),
					'singular_name'      => __( 'Email Template', 'lifterlms' ),
					'add_new'            => __( 'Add Email Template', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Email Template', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Email Template', 'lifterlms' ),
					'new_item'           => __( 'New Email Template', 'lifterlms' ),
					'view'               => __( 'View Email Template', 'lifterlms' ),
					'view_item'          => __( 'View Email Template', 'lifterlms' ),
					'search_items'       => __( 'Search Email Templates', 'lifterlms' ),
					'not_found'          => __( 'No Emails found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Emails found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Email Templates', 'lifterlms' ),
					'menu_name'          => _x( 'Emails', 'Admin menu name', 'lifterlms' ),
				),
				'public'              => false,
				'show_ui'             => ( current_user_can( apply_filters( 'lifterlms_admin_emails_access', 'manage_lifterlms' ) ) ) ? true : false,
				'map_meta_cap'        => true,
				'publicly_queryable'  => false,
				'exclude_from_search' => true,
				'show_in_menu'        => 'edit.php?post_type=llms_engagement',
				'hierarchical'        => false,
				'show_in_nav_menus'   => false,
				'rewrite'             => false,
				'query_var'           => false,
				'supports'            => array( 'title', 'editor' ),
				'has_archive'         => false,
			)
		);

		// Coupon.
		self::register_post_type(
			'llms_coupon',
			array(
				'labels'              => array(
					'name'               => __( 'Coupons', 'lifterlms' ),
					'singular_name'      => __( 'Coupon', 'lifterlms' ),
					'add_new'            => __( 'Add Coupon', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Coupon', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Coupon', 'lifterlms' ),
					'new_item'           => __( 'New Coupon', 'lifterlms' ),
					'view'               => __( 'View Coupon', 'lifterlms' ),
					'view_item'          => __( 'View Coupon', 'lifterlms' ),
					'search_items'       => __( 'Search Coupon', 'lifterlms' ),
					'not_found'          => __( 'No Coupon found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Coupon found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Coupon', 'lifterlms' ),
					'menu_name'          => _x( 'Coupons', 'Admin menu name', 'lifterlms' ),
				),
				'public'              => false,
				'show_ui'             => ( current_user_can( apply_filters( 'lifterlms_admin_coupons_access', 'manage_lifterlms' ) ) ) ? true : false,
				'map_meta_cap'        => true,
				'publicly_queryable'  => false,
				'exclude_from_search' => true,
				'show_in_menu'        => 'edit.php?post_type=llms_order',
				'hierarchical'        => false,
				'show_in_nav_menus'   => false,
				'rewrite'             => false,
				'query_var'           => false,
				'supports'            => array( 'title' ),
				'has_archive'         => false,
			)
		);

		// Voucher.
		self::register_post_type(
			'llms_voucher',
			array(
				'labels'              => array(
					'name'               => __( 'Vouchers', 'lifterlms' ),
					'singular_name'      => __( 'Voucher', 'lifterlms' ),
					'add_new'            => __( 'Add Voucher', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Voucher', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Voucher', 'lifterlms' ),
					'new_item'           => __( 'New Voucher', 'lifterlms' ),
					'view'               => __( 'View Voucher', 'lifterlms' ),
					'view_item'          => __( 'View Voucher', 'lifterlms' ),
					'search_items'       => __( 'Search Voucher', 'lifterlms' ),
					'not_found'          => __( 'No Voucher found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Voucher found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Voucher', 'lifterlms' ),
					'menu_name'          => _x( 'Vouchers', 'Admin menu name', 'lifterlms' ),
				),
				'public'              => false,
				'show_ui'             => ( current_user_can( apply_filters( 'lifterlms_admin_vouchers_access', 'manage_lifterlms' ) ) ) ? true : false,
				'map_meta_cap'        => true,
				'publicly_queryable'  => false,
				'exclude_from_search' => true,
				'show_in_menu'        => 'edit.php?post_type=llms_order',
				'hierarchical'        => false,
				'show_in_nav_menus'   => false,
				'rewrite'             => false,
				'query_var'           => false,
				'supports'            => array( 'title' ),
				'has_archive'         => false,
			)
		);

		// Review.
		self::register_post_type(
			'llms_review',
			array(
				'labels'              => array(
					'name'               => __( 'Reviews', 'lifterlms' ),
					'singular_name'      => __( 'Review', 'lifterlms' ),
					'menu_name'          => _x( 'Reviews', 'Admin menu name', 'lifterlms' ),
					'add_new'            => __( 'Add Review', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Review', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Review', 'lifterlms' ),
					'new_item'           => __( 'New Review', 'lifterlms' ),
					'view'               => __( 'View Review', 'lifterlms' ),
					'view_item'          => __( 'View Review', 'lifterlms' ),
					'search_items'       => __( 'Search Reviews', 'lifterlms' ),
					'not_found'          => __( 'No Reviews found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Reviews found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Review', 'lifterlms' ),
				),
				'public'              => false,
				'show_ui'             => ( current_user_can( apply_filters( 'lifterlms_admin_reviews_access', 'manage_lifterlms' ) ) ) ? true : false,
				'map_meta_cap'        => true,
				'publicly_queryable'  => false,
				'exclude_from_search' => true,
				'show_in_menu'        => 'edit.php?post_type=course',
				'hierarchical'        => false,
				'show_in_nav_menus'   => false,
				'rewrite'             => false,
				'query_var'           => false,
				'has_archive'         => false,
				'supports'            => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields', 'page-attributes' ),
			)
		);

		// Access Plan.
		self::register_post_type(
			'llms_access_plan',
			array(
				'labels'              => array(
					'name'               => __( 'Access Plans', 'lifterlms' ),
					'singular_name'      => __( 'Access Plan', 'lifterlms' ),
					'add_new'            => __( 'Add Access Plan', 'lifterlms' ),
					'add_new_item'       => __( 'Add New Access Plan', 'lifterlms' ),
					'edit'               => __( 'Edit', 'lifterlms' ),
					'edit_item'          => __( 'Edit Access Plan', 'lifterlms' ),
					'new_item'           => __( 'New Access Plan', 'lifterlms' ),
					'view'               => __( 'View Access Plan', 'lifterlms' ),
					'view_item'          => __( 'View Access Plan', 'lifterlms' ),
					'search_items'       => __( 'Search Access Plans', 'lifterlms' ),
					'not_found'          => __( 'No Access Plans found', 'lifterlms' ),
					'not_found_in_trash' => __( 'No Access Plans found in trash', 'lifterlms' ),
					'parent'             => __( 'Parent Access Plans', 'lifterlms' ),
					'menu_name'          => _x( 'Access Plans', 'Admin menu name', 'lifterlms' ),
				),
				'public'              => false,
				'show_ui'             => false,
				'map_meta_cap'        => true,
				'publicly_queryable'  => false,
				'exclude_from_search' => true,
				/**
				 * Making this post type hierarchical prevents a conflict
				 * with the Redirection plugin (https://wordpress.org/plugins/redirection/)
				 * When 301 monitoring is turned on, Redirection creates access plans
				 * for each access plan that redirect the course or membership
				 * to the site's home page.
				 */
				'hierarchical'        => true,
				'show_in_nav_menus'   => false,
				'rewrite'             => false,
				'query_var'           => false,
				'supports'            => array( 'title' ),
				'has_archive'         => false,
			)
		);

	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Show llms_my_certificate ui (edit) only to who can manage_lifterlms. Register llms_my_achievement post type. Add thumbnail support for achievement and certificates (earned and template) Renames llms_certificate slug from certificate to certificate-template. Rename llms_my_certificate slug from my_certificate to certificate. Replaced the use of the deprecated get_page() function withget_post()`.
5.8.0 Remove all post type descriptions.
5.5.0 Register all the post types using self::register_post_type().
4.5.1 Removed "excerpt" support for the course post type.
4.17.0 Add "llms-sales-page" feature to course and membership post types.
3.37.12 Added 'revisions' support to course, lesson, and llms_mebership post types.
3.33.0 llms_question post type is not publicly queryable anymore.
3.0.4 Made 'llms_access_plan' post type hierarchical to prevent a conflict with the Redirection plugin.
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.