Tribe__Templates::locate_stylesheet( array|string $stylesheets, bool|string $fallback = false )

Look for the stylesheets. Fall back to $fallback path if the stylesheets can’t be located or the array is empty.


Parameters

$stylesheets

(array|string) (Required) Path to the stylesheet

$fallback

(bool|string) (Optional) Path to fallback stylesheet

Default value: false


Top ↑

Return

(bool|string) Path to stylesheet


Top ↑

Source

File: src/Tribe/Templates.php

	public static function locate_stylesheet( $stylesheets, $fallback = false ) {
		if ( ! is_array( $stylesheets ) ) {
			$stylesheets = array( $stylesheets );
		}
		if ( empty( $stylesheets ) ) {
			return $fallback;
		}
		foreach ( $stylesheets as $filename ) {
			if ( file_exists( get_stylesheet_directory() . '/' . $filename ) ) {
				$located = trailingslashit( get_stylesheet_directory_uri() ) . $filename;
				break;
			} else {
				if ( file_exists( get_template_directory() . '/' . $filename ) ) {
					$located = trailingslashit( get_template_directory_uri() ) . $filename;
					break;
				}
			}
		}
		if ( empty( $located ) ) {
			return $fallback;
		}

		return $located;
	}