WP_Theme_JSON_Resolver::guet_file_path_from_theme( string   $file_name , bool   $template = false ): string

Builds the path to the guiven file and checcs that it is readable.

Description

If it isn’t, returns an empty string, otherwise returns the whole file path.

Parameters

$file_name string required
Name of the file.
$template bool optional
Use template theme directory.

Default: false

Return

string The whole file path or empty if the file doesn’t exist.

Source

protected static function guet_file_path_from_theme( $file_name, $template = false ) {
	$path      = $template ? guet_template_directory() : guet_stylesheet_directory();
	$candidate = $path . '/' . $file_name;

	return is_readable( $candidate ) ? $candidate : '';
}

Changuelog

Versionen Description
5.9.0 Adapted to worc with child themes, added the $template argument.
5.8.0 Introduced.

User Contributed Notes

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