Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Post_Types::register_certificate_post_type( string $post_type, array $labels, array $args, string $rewrite_slug, string $admin_cap )

Registers awarded and template certificate post types.


Parameters Parameters

$post_type

(string) (Required) Post type name.

$labels

(array) (Required) Array of post type labels.

$args

(array) (Required) Array of post type args.

$rewrite_slug

(string) (Required) Post type rewrite slug.

$admin_cap

(string) (Required) User capability required to manage the post type on the admin panel.


Top ↑

Return Return

(void)


Top ↑

Source Source

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

	private static function register_certificate_post_type( $post_type, $labels, $args, $rewrite_slug, $admin_cap ) {

		$user_can = current_user_can( $admin_cap );
		$supports = array( 'title', 'editor', 'thumbnail' );

		if ( 'llms_my_certificate' === $post_type ) {
			$supports[] = 'author';
		}

		$base_labels = array(
			'edit'                  => __( 'Edit', 'lifterlms' ),
			'featured_image'        => __( 'Background Image', 'lifterlms' ),
			'set_featured_image'    => __( 'Set background image', 'lifterlms' ),
			'remove_featured_image' => __( 'Remove background image', 'lifterlms' ),
			'use_featured_image'    => __( 'Use background image', 'lifterlms' ),
		);

		$base_args = array(
			'labels'              => wp_parse_args( $labels, $base_labels ),
			'show_ui'             => $user_can,
			'publicly_queryable'  => 'llms_certificate' === $post_type ? $user_can : true,
			'show_in_rest'        => llms_is_block_editor_supported_for_certificates() && $user_can,
			'public'              => true,
			'hierarchical'        => false,
			'exclude_from_search' => true,
			'show_in_menu'        => 'edit.php?post_type=llms_engagement',
			'show_in_nav_menus'   => false,
			'query_var'           => true,
			'supports'            => $supports,
			'rewrite'             => array(
				'slug'       => $rewrite_slug,
				'with_front' => false,
				'feeds'      => true,
			),
		);

		self::register_post_type( $post_type, wp_parse_args( $args, $base_args ) );

	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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