我有一个不在Wordpress上运行的网站,但已在/ blog子目录中安装了Wordpress . 我正在尝试修改所选的Wordpress主题以匹配我的网站的 Headers . 我已经设法相对接近,但通过在子主题中放置重复的.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
    ---需要的文件

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