什么';在wordpress中对脚本进行排队时,get_样式表、目录和uri()与get_模板、目录和uri()之间的区别是什么
这不是一个严肃的问题 在WordPress中对脚本进行排队时,我通常使用什么';在wordpress中对脚本进行排队时,get_样式表、目录和uri()与get_模板、目录和uri()之间的区别是什么,wordpress,Wordpress,这不是一个严肃的问题 在WordPress中对脚本进行排队时,我通常使用get\u stylesheet\u directory\u uri() 我只是想知道在wordpress中对脚本排队时,get\u stylesheet\u directory\u uri()和get\u template\u directory\u uri()之间有什么区别 根据WordPress法典: get\u template\u directory\u uri->检索 当前主题 获取样式表目录uri->检索的样
get\u stylesheet\u directory\u uri()
我只是想知道在wordpress中对脚本排队时,get\u stylesheet\u directory\u uri()
和get\u template\u directory\u uri()
之间有什么区别
根据WordPress法典:
get\u template\u directory\u uri
->检索
当前主题
获取样式表目录uri
->检索的样式表目录uri
当前主题/子主题
然后,get\u template\u directory\u uri
不能用于子主题?这两个函数都可以用于父主题或子主题
将始终引用资源的父主题文件夹
将引用资产的“当前”主题文件夹(可以是父文件夹,也可以是子文件夹,具体取决于调用位置)
例如,在子主题中:
// This will point to style.css in child theme
wp_enqueue_style( 'my_child_styles', get_stylesheet_directory_uri().'/style.css' );
// This will point to style.css in the parent theme
wp_enqueue_style( 'my_parent_styles', get_template_directory_uri().'/style.css' );
请注意,如果主题不是子主题,则它被视为父主题 什么惯例D:)