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_Block_Templates::get_maybe_overridden_block_template_file_path( string $template_file )

Retrieve the actual template file path, maybe overridden in the theme.


Parameters Parameters

$template_file

(string) (Required) The template's path.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-llms-block-templates.php

	 * @param string $template_file The template's path.
	 * @return string
	 */
	private function get_maybe_overridden_block_template_file_path( $template_file ) {

		$template_path_info  = pathinfo( $template_file );
		$template_file_name  = $template_path_info['filename'];
		$template_blocks_dir = untrailingslashit( $this->generate_template_blocks_dir_from_path( $template_file ) ); // Looks like 'block-templates'.

		/**
		 * Does this come from LifterLMS or from an add-on? In the latter case use the absolute path.
		 *
		 * $template_path_info['dirname'] looks like 'ABSPATH/wp-content/plugins/lifterlms/templates/block-templates' or
		 * 'ABSPATH/wp-content/plugins/lifterlms-groups/templates/block-templates' for an add-on.
		 */
		return false !== strpos( $template_path_info['dirname'], trailingslashit( llms()->plugin_path() ) )
			?
			llms_template_file_path(
				$template_blocks_dir . '/' . $template_file_name . '.html'
			)
			:
			llms_template_file_path(
				$template_blocks_dir . '/' . $template_file_name . '.html', // Looks like 'block-templates/single-llms_group.html'.
				substr( $template_path_info['dirname'], 0, -1 * strlen( $template_blocks_dir ) ), // Looks like 'ABSPATH/wp-content/plugins/lifterlms-groups/templates/'.
				true

Top ↑

Changelog Changelog

Changelog
Version Description
5.9.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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