为什么未将样式应用于wordpress自定义主题?

我已经从w3layouts下载了模板。我希望将此模板显示为wordpress主题。我已经将index.html转换为index.php,并且style.css和index.php都在同一目录中,我还使用了PHP的bloginfo()函数。这是我的index.php的头部

<link rel="icon" href="<?php bloginfo('img/favicon.png')?>" />
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="<?php bloginfo('bootstrap.min.css')?>" />
    <!-- animate CSS -->
    <link rel="stylesheet" href="<?php bloginfo('animate.css')?>" />
    <!-- owl carousel CSS -->
    <link rel="stylesheet" href="<?php bloginfo('owl.carousel.min.css')?>" />
    <!-- themify CSS -->
    <link rel="stylesheet" href="<?php bloginfo('themify-icons.css')?>" />
    <!-- flaticon CSS -->
    <link rel="stylesheet" href="<?php bloginfo('flaticon.css')?>" />
    <!-- font awesome CSS -->
    <link rel="stylesheet" href="<?php bloginfo('magnific-popup.css')?>" />
    <!-- swiper CSS -->
    <link rel="stylesheet" href="<?php bloginfo('slick.css')?>" />
    <!-- style CSS -->
    <link rel="stylesheet" href="<?php bloginfo('style.css')?>" />

我已将模板的文件夹放在wordpress的主题文件夹中。 index.php和style.css都在css文件夹中。我是wordpress的新手。预先感谢

qazaqq11 回答:为什么未将样式应用于wordpress自定义主题?

在您的functions.php文件中添加以下内容:
/ resources / css /是样式的路径。

define( 'THEME_DIR',get_template_directory_uri() )

wp_enqueue_style( 'main-style-css',THEME_DIR . '/resources/css/style.css' );

稍后在HTML模板的head标签中添加

<head>
// ... ...
wp_head();

</head>
本文链接:https://www.f2er.com/3167558.html

大家都在问