llms_get_certificate( WP_Post|int|null $post = null, boolean $preview_template = false )

Retrieve the LLMS_User_Certificate instance for a given post.


Description Description

Expects the input post to be either an llms_my_certificate post. An llms_certificate post can be used when $preview_template is true.


Top ↑

Parameters Parameters

$post

(WP_Post|int|null) (Optional) A WP_Post object or a WP_Post ID. A falsy value will use the current global $post object (if one exists).

Default value: null

$preview_template

(boolean) (Optional) If true, allows loading an llms_certificate post type for previewing the template.

Default value: false


Top ↑

Return Return

(LLMS_User_Certificate|boolean) Returns the LLMS_User_Certificate object for the given post. Returns false if the post doesn't exist or is not of the expected post type.


Top ↑

Source Source

File: includes/functions/llms.functions.certificate.php

function llms_get_certificate( $post = null, $preview_template = false ) {

	$post = get_post( $post );
	if ( ! $post ) {
		return false;
	}

	if ( 'llms_my_certificate' === $post->post_type || ( 'llms_certificate' === $post->post_type && $preview_template ) ) {
		return new LLMS_User_Certificate( $post );
	}

	return false;

}


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.