Как исправить не полностью загруженный родительский стиль в дочерней теме? - PullRequest
0 голосов
/ 07 октября 2019

Родительская таблица стилей не полностью загружена в моей дочерней теме. Как я могу решить это?

Это мой текущий код

add_action('wp_enqueue_scripts', 'cleaningservices_enqueue_styles');

function cleaningservices_enqueue_styles() {
    $parent_style = 'parent-style'; // This is 'cleaning-services-style' for the Cleaning Services theme.

    wp_enqueue_style($parent_style, get_parent_theme_file_uri() . '/style.css');
    wp_enqueue_style('child-style', get_stylesheet_directory_uri() . '/style.css', array($parent_style), wp_get_theme()->get('Version'));
}

1 Ответ

0 голосов
/ 07 октября 2019

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

add_action('wp_enqueue_scripts', 'cleaningservices_enqueue_styles');

function cleaningservices_enqueue_styles() {
    $parent_style = 'parent-style'; // This is 'cleaning-services-style' for the Cleaning Services theme.

    wp_enqueue_style($parent_style, get_parent_theme_file_uri( 'style.css' ));
    wp_enqueue_style('child-style', get_stylesheet_directory_uri() . '/style.css', array($parent_style), wp_get_theme()->get('Version'));
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...