llms_get_template_part( string $slug, string $name = '' )

Get template part


Parameters Parameters

$slug

(string) (Required) The slug name for the generic template.

$name

(string) (Optional) The name of the specialised template. Default is empty string.

Default value: ''


Top ↑

Return Return

(void)


Top ↑

Source Source

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

function llms_get_template_part( $slug, $name = '' ) {
	$template = '';

	if ( $name ) {
		$template = llms_locate_template( "{$slug}-{$name}.php", llms()->template_path() . "{$slug}-{$name}.php" );
	}

	// Get default slug-name.php.
	if ( ! $template && $name && file_exists( llms()->plugin_path() . "/templates/{$slug}-{$name}.php" ) ) {
		$template = llms()->plugin_path() . "/templates/{$slug}-{$name}.php";
	}

	if ( ! $template ) {
		$template = llms_locate_template( "{$slug}.php", llms()->template_path() . "{$slug}.php" );
	}

	/**
	 * Filters the template file path
	 *
	 * Allow 3rd party plugin filter template file from their plugin.
	 *
	 * @since Unknown
	 *
	 * @param string $template The path to the template file.
	 * @param string $slug     The slug name for the generic template.
	 * @param stirng $name     The name of the specialised template.
	 */
	$template = apply_filters( 'llms_get_template_part', $template, $slug, $name );

	if ( $template ) {
		load_template( $template, false );
	}
}


Top ↑

User Contributed Notes User Contributed Notes

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