Wordpress:开发子主题会导致浏览器发出两个css请求

Wordpress:开发子主题会导致浏览器发出两个css请求,wordpress,wordpress-theming,Wordpress,Wordpress Theming,我想在wordpress支持的网站上工作。正如Wordpress社区所建议的,我应该创建一个儿童主题,并需要在其上编写代码。因此,将有两个css文件,一个css文件将是父主题,另一个将是子主题。那么,当最终用户请求时,会有两个css文件请求吗?假设您的主题名是theme-x 创建名为theme-x-child的文件夹 在文件夹中创建三个文件 1. functions.php <?php // // Recommended way to include parent theme styl

我想在wordpress支持的网站上工作。正如Wordpress社区所建议的,我应该创建一个儿童主题,并需要在其上编写代码。因此,将有两个css文件,一个css文件将是父主题,另一个将是子主题。那么,当最终用户请求时,会有两个css文件请求吗?

假设您的主题名是theme-x

创建名为theme-x-child的文件夹

在文件夹中创建三个文件

1. functions.php 

<?php
//
// Recommended way to include parent theme styles.
//  (Please see http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme)
//  
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( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array('parent-style')
    );
}
//
// Your code goes below
//

2. rtl.php

/*
Theme Name:     Theme-x Child
Template:       

Right to Left text support.
*/
@import url("../Theme-x/rtl.css");

3.style

/*
Theme Name:     Theme-x Child
Description:    wordpress
Author:         admin
Template:       Theme-x Child

(optional values you can add: Theme URI, Author URI, Version, License, License URI, Tags, Text Domain)
*/
1。functions.php

欢迎来到SO。请先阅读,然后访问,最后阅读并提供一份。您也可以考虑使用专用的