get_parent_theme_file_path() - WordPress 函数参考中文文档

返回介绍

get_parent_theme_file_path()

发布于 2017-09-10 字数1553 浏览 926 评论 0

get_parent_theme_file_path( string $file = '' )

Retrieves the path of a file in the parent theme.


描述


参数

$file

(string)
(Optional)
File to return the path for in the template directory.

Default value: ”


返回值

(string) The path of the file.


源代码

File: wp-includes/link-template.php

function get_parent_theme_file_path( $file = '' ) {
	$file = ltrim( $file, '/' );

	if ( empty( $file ) ) {
		$path = get_template_directory();
	} else {
		$path = get_template_directory() . '/' . $file;
	}

	/**
	 * Filters the path to a file in the parent theme.
	 *
	 * @since 4.7.0
	 *
	 * @param string $path The file path.
	 * @param string $file The requested file to search for.
	 */
	return apply_filters( 'parent_theme_file_path', $path, $file );
}

更新日志

Version 描述
4.7.0 Introduced.

相关函数

Uses

  • wp-includes/link-template.php:
    parent_theme_file_path
  • wp-includes/theme.php:
    get_template_directory()
  • wp-includes/plugin.php:
    apply_filters()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!