llms_get_template( string $template_name, array $args = array(), string $template_path = '', string $default_path = '' )

Get Template Part


Parameters Parameters

$template_name

(string) (Required) Name of template.

$args

(array) (Optional) Array of arguments accessible from the template.

Default value: array()

$template_path

(string) (Optional) Dir path to template. Default is empty string. If not supplied the one retrived from llms()->template_path() will be used.

Default value: ''

$default_path

(string) (Optional) Default path is empty string. If not supplied the template path is llms()->plugin_path() . '/templates/'.

Default value: ''


Top ↑

Return Return

(void)


Top ↑

Source Source

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

function llms_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
	if ( $args && is_array( $args ) ) {
		extract( $args );
	}

	$located = llms_locate_template( $template_name, $template_path, $default_path );

	/**
	 * Fired before a template part is included
	 *
	 * @since Unknown
	 *
	 * @param string $template_name Name of template.
	 * @param string $template_path Dir path to template as passed to the `llms_get_template()` function.
	 * @param string $located       The full path of the template file to load.
	 * @param array  $args          Array of arguments accessible from the template.
	 */
	do_action( 'lifterlms_before_template_part', $template_name, $template_path, $located, $args );

	if ( file_exists( $located ) ) {
		include $located;
	}

	/**
	 * Fired after a template part is included
	 *
	 * @since Unknown
	 *
	 * @param string $template_name Name of template.
	 * @param string $template_path Dir path to template as passed to the `llms_get_template()` function.
	 * @param string $located       The full path of the (maybe) loaded template file.
	 * @param array  $args          Array of arguments accessible from the template.
	 */
	do_action( 'lifterlms_after_template_part', $template_name, $template_path, $located, $args );
}


Top ↑

Changelog Changelog

Changelog
Version Description
3.16.0 Unknown
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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