get_template_directory_uri

函数
get_template_directory_uri ( No parameters )
返回值
  • (string) URI to active theme's template directory.
定义位置
相关方法
get_template_directoryget_stylesheet_directory_uriget_template_hierarchyget_template_part_get_template_edit_filename
引入
1.5.0
弃用
-

get_template_directory_uri: 这个函数检索到当前主题目录的URL。它不接受任何参数,以字符串形式返回主题目录的URL。

检索活动主题的模板目录URI。

function get_template_directory_uri() {
	$template         = str_replace( '%2F', '/', rawurlencode( get_template() ) );
	$theme_root_uri   = get_theme_root_uri( $template );
	$template_dir_uri = "$theme_root_uri/$template";

	/**
	 * Filters the active theme directory URI.
	 *
	 * @since 1.5.0
	 *
	 * @param string $template_dir_uri The URI of the active theme directory.
	 * @param string $template         Directory name of the active theme.
	 * @param string $theme_root_uri   The themes root URI.
	 */
	return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-15 02:36:46

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: