Javascript style.css不适用于wordpress子主题

Javascript style.css不适用于wordpress子主题,javascript,php,html,css,twitter-bootstrap,Javascript,Php,Html,Css,Twitter Bootstrap,我制作了WP ocean的子主题,但是它的style.css不起作用,在我制作twenty 199的子主题之前,它的所有功能都在工作,但是我为WP ocean添加了相同的功能,但是它的样式表没有加载,所以我正在做内联样式。下面是我的功能代码 <?php add_theme_support('menus'); add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); function my_theme_enqueue_st

我制作了WP ocean的子主题,但是它的style.css不起作用,在我制作twenty 199的子主题之前,它的所有功能都在工作,但是我为WP ocean添加了相同的功能,但是它的样式表没有加载,所以我正在做内联样式。下面是我的功能代码

<?php

add_theme_support('menus');
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'child-style', get_stylesheet_uri() );

}



function wpb_custom_new_menu() {
register_nav_menu('my-custom-menu',__( 'My Custom Menu' ));
}
add_action( 'init', 'wpb_custom_new_menu' );


function my_scripts() {

wp_enqueue_style('bootstrap4', 
'https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css');
 wp_enqueue_script( 'boot1','https://code.jquery.com/jquery-3.3.1.slim.min.js', array( 'jquery' 
 ),'',true );
 wp_enqueue_script( 
 'boot2','https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js', array( 'jquery' 
),'',true );
wp_enqueue_script( 'boot3','https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js', 
array( 'jquery' ),'',true );
}
add_action( 'wp_enqueue_scripts', 'my_scripts' );


function arphabet_widgets_init() {

register_sidebar(array(
    'name' => 'My_Widgtet_Area',
    'id' => 'partner-slide',
    'before_widget' => '<div>',
    'after_widget' => '</div>',
    'before_title' => '<h2 class="rounded">',
    'after_title' => '</h2>',
));
}

add_action('widgets_init', 'arphabet_widgets_init');

function prefix_add_content ($content){

return $content;
}
add_filter ('the_content', 'prefix_add_content');
身体{ 颜色:#ff8b00!重要; }

这是css文件中的样式,而不是内联样式。在HTML标记中写入样式,则它是内联样式,具有最高优先级


我不熟悉Wordpress,但在这种情况下,您可以假设Wordpress首先加载您的样式表文件,然后使用“219”中的样式覆盖您自己的文件

1、第一个创建函数add style.css

/*
Theme Name: Oceanwp Child
Theme URI: http://example.com/oceanwp-child/
Description: Oceanwp Child Theme
Author: John Doe
Author URI: http://example.com
Template: oceanwp
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, 
accessibility-ready
Text Domain: Oceanwp-Child
*/
@import
body{
color: #ff8b00!important;
}
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');
function my_theme_enqueue_styles() {
   wp_enqueue_style('child-style', get_theme_file_uri('/style.css'));
}
2、文件中的style.css要求

/*
Theme Name:     Theme Child Name
Template:       Parent theme
*/

我尝试了一个不同的主题astral theme,并在my functions.php和my style.css中添加了这个函数开始工作

add_action( 'wp_enqueue_scripts', 'my_plugin_add_stylesheet' );
function my_plugin_add_stylesheet() {
wp_enqueue_style( 'my-style', get_stylesheet_directory_uri() . '/style.css', false, 
'1.0', 'all' );
}

请提供您孩子的
style.css
theme@Mulli我添加了我的子主题的style.css,我试图更改主题的主体颜色,但是style.css不起作用您的
@import
行在
style.css
中出错。请看官方的oceanwp儿童主题。这可能无法解决问题,但会清除错误。要解决问题,请提供指向页面的链接。我在my Functions.php和my style.css中添加了此链接。替换主题不是问题的解决方案,而是完全不同的路径。因此,你不能把它作为一个“答案”。如果您希望找到原始版本的解决方案,请参阅我的上述评论problem@Mulli很抱歉没有提及,我的ocean WP也在工作,因为我在我的函数php中添加了上述函数。事实上,我在代码中使用了一个插件作为滑块,而我的代码中没有插件函数,这可能就是为什么我的样式表无法正常工作的原因,通过添加上述函数,我解决了我的问题。通过“style.css无法正常工作”-你的意思是IIT未包含在页面html中。一旦您检查它是否出现,您就可以验证相应的css选择器是否执行了job@Mulli我想你没有明白我的意思,我制作了一个子主题并添加了style.css,但当我在主题体中添加代码,然后尝试通过在style.css中设置样式来设置主题的样式,但我的任何样式实际上都不工作style.css没有加载,所以最后我在functions.php中添加了上述函数,我的style.css开始工作,现在我可以设置我的主题的样式。希望你明白我的意思,谢谢。