长话短说:get_bloginfo( \'template_directory\' ) 和get_bloginfo( \'template_url\' ) 只需返回get_template_directory_uri().
因此,只需直接引用后一个模板标记,就可以简化第二个调用。
Refer to source for get_bloginfo().
其他一些:
\'url\' => home_url()\'wpurl\' => site_url()\'stylesheet_url\' => get_stylesheet_uri()\'stylesheet_directory\' => get_stylesheet_directory_uri()\'locale\' => get_locale()
编辑
注意:
TEMPLATEPATH and STYLESHEETPATH are slated for deprecation, 因此,您最好现在用
get_template_directory() 和
get_stylesheet_directory(), 分别地
编辑2关于:此评论
正是我要说的:)。我想补充一点get_template_directory() 返回路径和get_template_directory_uri() url。所以作者的观点并不一致:get_bloginfo( \'template_directory\' ) 和get_template_directory() 返回不同的东西!
返回到源:)
case \'template_directory\':
case \'template_url\':
$output = get_template_directory_uri();
break;
回复:此评论:
开发儿童主题时需要注意的一点get_stylesheet_directory() 明确地如果我错了,有人纠正我。
没错,但一直都是这样。get_bloginfo() 不返回任何与get_stylesheet_directory(). 它只返回get_stylesheet_uri() 和get_stylesheet_directory_uri().