Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.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
Php 将样式表从主站点链接到Wordpress子主题_Php_Wordpress - Fatal编程技术网

Php 将样式表从主站点链接到Wordpress子主题

Php 将样式表从主站点链接到Wordpress子主题,php,wordpress,Php,Wordpress,我有一个网站没有在Wordpress上运行,但是已经在/blog子目录中安装了Wordpress。我正在尝试修改所选的Wordpress主题以匹配我的网站标题。我已经设法做到了比较接近,但是通过在子主题中放置重复的.css和.js文件 我想做的是在从functions.php排队时给出正确的路径-我只是不熟悉.php以及如何做到这一点。以下是我所拥有的: <?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); fu

我有一个网站没有在Wordpress上运行,但是已经在/blog子目录中安装了Wordpress。我正在尝试修改所选的Wordpress主题以匹配我的网站标题。我已经设法做到了比较接近,但是通过在子主题中放置重复的.css和.js文件

我想做的是在从functions.php排队时给出正确的路径-我只是不熟悉.php以及如何做到这一点。以下是我所拥有的:

<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'freelance-main', get_stylesheet_directory_uri() . '../../../freelancer.css' );
wp_enqueue_style( 'bootstrap-min', get_stylesheet_directory_uri() . '../../../bootstrap.min.css' );
wp_enqueue_style( 'bootstrap-main', get_stylesheet_directory_uri() . '../../../bootstrap.css' );
wp_enqueue_style( 'child-style',get_stylesheet_directory_uri() . '/style.css',
    array('parent-style')
);
}
?>

从查看页面源代码来看,它实际上是在尝试加载url中的“./”所以我知道这不对,我只是不知道如何正确地键入它。结构如下:


-我的网站
--博客
---可湿性粉剂含量
----主题
-----子主题
--css
---所需文件
--js
---所需文件

就像我说的,如果我复制文件并将它们放在子主题中,它会工作,但我认为这不是最佳实践