vimeotheque_get_template_part( mixed $slug, string $name = '' )

Get template part.


Description

VIMEOTHEQUE_TEMPLATE_DEBUG_MODE will prevent overrides in themes from taking priority.


Parameters

$slug

(Required) Template slug.

$name

(Optional) Template name (default: '').

Default value: ''


Source

File: includes/libs/templates/functions.php

function vimeotheque_get_template_part( $slug, $name = '' ){
	if ( $name ) {
		$template = VIMEOTHEQUE_TEMPLATE_DEBUG_MODE ? '' : locate_template(
			[
				"{$slug}-{$name}.php",
				Helper::template_path() . "{$slug}-{$name}.php",
			]
		);

		if ( ! $template ) {
			$fallback = \Vimeotheque\Helper::get_path() . "/templates/{$slug}-{$name}.php";
			$template = file_exists( $fallback ) ? $fallback : '';
		}
	}

	if ( ! $template ) {
		// If template file doesn't exist, look in WP theme.
		$template = VIMEOTHEQUE_TEMPLATE_DEBUG_MODE ? '' : locate_template(
			[
				"{$slug}.php",
				Helper::template_path() . "{$slug}.php",
			]
		);
	}

	/**
	 * Template file filter.
	 *
	 * Allow 3rd party plugins to filter template file from their plugin.
	 *
	 * @param string $template  The template file path.
	 * @param string $slug      The template slug.
	 * @param string $name      The template name.
	 */
	$template = apply_filters( 'vimeotheque_get_template_part', $template, $slug, $name );

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

Start your video site now!

Manage and coordinate your Vimeo channels, albums or videos with your WordPress website. Perfect fit for membership, portfolio, online courses or any type of video collection.

Get Vimeotheque PRO!