首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >子主题的样式表无法加载

子主题的样式表无法加载
EN

WordPress Development用户
提问于 2018-03-06 11:25:29
回答 1查看 146关注 0票数 0

我试图用它的子主题来修改一个主题。作者已经创建了一个儿童主题。

我在样式表中添加了很多东西,但是它不起作用。当我签入开发人员模式时。我看到样式表的链接rel是未定义

而style.css?ver=494是空的

我认为作者制作的functions.php有一些问题,所以我在这里附加了functions.php (子主题):

代码语言:javascript
复制
<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;

// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:

if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
    function chld_thm_cfg_parent_css() {
        wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array( 'bootstrap','animate-css','carousel-css','fancybox-css','webkit-css','font-awesome-css' ) );
    }
endif;
add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', 10 );

// END ENQUEUE PARENT ACTION

我还附上了以下style.css (儿童主题):

代码语言:javascript
复制
/*
Theme Name: Fitnesspoint Child
Theme URI: http://fitnesspointwptheme.staging7.in/fitnesspoint/
Template: fitnesspoint
Author: multidots
Author URI: https://store.multidots.com/themes/wordpress-themes/
Description: Fitness Point is an Wordpress template for health sports club, personal gym trainer, gym, gym shop and fitness websites. It is a highly suitable template for fitness companies as well as gyms or sports clubs. It has the purpose oriented design, responsive layout and special features like gym shop, services, courses, fitness plans and other pages.
Tags: custom-header,custom-background,threaded-comments,sticky-post,translation-ready,microformats,editor-style,custom-menu
Version: 1.8.3

*/

#primary-menu i.fa.fa-home {
    font-size:  20px;
}

section#huan-luyen {
    background-repeat: no-repeat;
    background-position: right;
    background-size: auto 100%;
}

.back-to-top {
    height: 130px;
    right: 25px;
}

请帮帮我!

S:我想听听你对更改mysite字体的想法。主题是使用拉丁文的Google。但我的网站是越南语。怎么改呢?Tnx

EN

回答 1

WordPress Development用户

发布于 2018-03-06 11:52:32

简单使用:get_stylesheet_directory_uri();

而不是get_template_directory_uri();

编辑:

如果使用子主题,则get_stylesheet_directory_uri();函数返回当前子主题的URL。如果要将URL返回到根/父主题,请使用get_template_directory_uri();。这就是它能解决问题的原因。

票数 1
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/295940

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档