llms_get_certificate_title( int $id )

Retrieve the title of a certificate


Description Description

This function is intended for use on the certificate’s front-end display template.


Top ↑

Parameters Parameters

$id

(int) (Required) WP Certificate Post ID. When not provide the current post id will be used.


Top ↑

Return Return

(string) The title of the certificate.


Top ↑

Source Source

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

function llms_get_certificate_title( $id = 0 ) {

	$id          = $id ? $id : get_the_ID();
	$title       = '';
	$certificate = llms_get_certificate( $id, false );
	if ( $certificate ) {
		$title = $certificate->get( 'title' );
	} elseif ( 'llms_certificate' === get_post_type( $id ) ) {
		$title = get_post_meta( $id, '_llms_certificate_title', true );
	}

	/**
	 * Filter the title of a certificate or certificate template.
	 *
	 * @since Unknown
	 * @since 6.0.0 Added the `$certificate` parameter.
	 *
	 * @param string $title The certificate title.
	 * @param int    $id    The ID of the certificate.
	 */
	return apply_filters( 'lifterlms_certificate_title', $title, $id );

}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Use LLMS_User_Certificate() to retrieve the title for earned certificates.
2.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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