首页 > 在wordpress的子主题中引用文件如何写?

在wordpress的子主题中引用文件如何写?

在wordpress的子主题的functions.php文件中用下面的代码引用一个php文件,结果前台后台都出现了500错误。
请教大神哪里写的不对?

require_once get_stylesheet_directory_uri() . '/custom/login.php';

在子主题中不就是应该用get_stylesheet_directory_uri()获取当前子主题的路径么?
谢谢


我一般这么写:

require_once(TEMPLATEPATH . '/custom/login.php');

真是不好意思了,找到问题出在哪里了,是我自己用错了钩子了,应该用get_stylesheet_directory()

require_once get_stylesheet_directory() . '/custom/login.php';
【热门文章】
【热门文章】