WordPress Двадцать двадцать тема для ребенка css не эффективна - PullRequest
0 голосов
/ 16 февраля 2020

Я следовал всем инструкциям, чтобы создать свою дочернюю тему. В функциях. php, у меня есть:

<?php

    add_action( 'wp_enqueue_scripts', 'tt_child_enqueue_parent_styles' );

    function tt_child_enqueue_parent_styles() {
       wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }

?>

В стиле. css, у меня правильная часть комментария к заголовку:

/*
 Theme Name:   Twenty Twenty Child
 Theme URI:    http://example.com/twenty-twenty-child/
 Description:  Twenty Twenty Child Theme
 Author:       X Y
 Author URI:   http://example.com
 Template:     twentytwenty
 Version:      1.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:  twentytwentychild
*/

h1 {
    visibility: hidden;
}

Однако, кажется, дочерний стиль. css не работает, никакого эффекта. На странице HTML код, строки ниже отображаются и выглядят правильно:

<link rel='stylesheet' id='parent-style-css'  href='https://lifepromise.co.uk/wp-content/themes/twentytwenty/style.css' media='all' />
<link rel='stylesheet' id='twentytwenty-style-css'  href='https://lifepromise.co.uk/wp-content/themes/twentytwenty-child/style.css' media='all' />

1 Ответ

0 голосов
/ 16 февраля 2020

Попробуйте этот код на функции. php

add_action( 'wp_enqueue_scripts', 'tt_child_enqueue_parent_styles' );

function tt_child_enqueue_parent_styles() {
   wp_enqueue_style( 'twentytwenty-style', get_template_directory_uri().'/style.css' );
   wp_enqueue_style( 'child-style', get_stylesheet_directory_uri().'/style.css', array('twentytwenty-style') );
}

Проверено и работает

...