Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
什么';在wordpress中对脚本进行排队时,get_样式表、目录和uri()与get_模板、目录和uri()之间的区别是什么_Wordpress - Fatal编程技术网

什么';在wordpress中对脚本进行排队时,get_样式表、目录和uri()与get_模板、目录和uri()之间的区别是什么

什么';在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->检索的样

这不是一个严肃的问题

在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
    ->检索的样式表目录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:)