0

Я уже все перепробовал, ничего не получилось а задача такая, при изменении в дочернем файле style.css надо что бы изменялось на сайте например изменить цвет фона. Помогите я уже не знаю что делать.

function.php

<?php
// Direct access output
if ( !defined( 'ABSPATH' ) ) exit;

// START ACTION FOR PARENTS
// IS GENERATED AUTOMATICALLY. Do not change or remove the comment markers above or below:

if ( !function_exists( 'chld_thm_cfg_locale_css' ) ):
    function chld_thm_cfg_locale_css( $uri ){
        if ( empty( $uri ) && is_rtl() && file_exists( get_template_directory() . '/rtl.css' ) )
            $uri = get_template_directory_uri() . '/rtl.css';
        return $uri;
    }
endif;
add_filter( 'locale_stylesheet_uri', 'chld_thm_cfg_locale_css' );

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(  ) );
        wp_enqueue_style( 'my_child_styles', get_stylesheet_directory_uri().'/style.css' );
    }
endif;

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );

// COMPLETE PARENT ACTION
?>

style.css

/*
Theme Name: PressBook Child
Theme URI: https://scriptstown.com/wordpress-themes/pressbook/
Template: pressbook
Author: ScriptsTown
Author URI: https://scriptstown.com/
Description: PressBook is a multi-purpose WordPress theme suitable for blogs, news, marketing, and educational websites. The theme offers a fully responsive, clean, modern, and pixel-perfect design that can adjust automatically to fit the content elements in the best possible manner for any screen-size device. It has a minimal dependency and offers high performance with quick loading time. It supports double sidebars, single sidebar, footer widgets, eye-catching gradient colors scheme for buttons and top bar, top advertisement banner area with custom header background, and customizable options. Both the sidebars can be configured to be shown on the left or on the right. This theme is great to publish tutorials, documentations, events, status updates, story updates, technology blogs, newsfeed, etc. It comes with sticky sidebars that float with scrolling. The theme supports multiple page templates with page-level layout settings, blog layouts, conditional header block area, page builders, different color settings, footer options, and much more. Also, it comes with three menu locations which include a fully accessible multi-level primary menu with search form, top bar navigation menu, and social links menu. This theme is also great for building school, university, institute, academic, or educational websites.
Version: 1.7.4
*/
.entry-title a {color: #f92c8b !important}

body{
    background-color:red;
}

А задача такая, при изменении в дочернем файле style.css надо что бы изменялось на сайте например изменить цвет фона. Помогите я уже не знаю что делать.

4
  • Опишите подробно последовательность действий, как создавали и настраивали дочернюю тему. Прям по шагам, если можно
    – rusgeli
    21 окт 2022 в 6:45
  • Для начала определись с задачей - создать тему или " при изменении в дочернем файле style.css надо что бы изменялось на сайте". Это две разные задачи.
    – SeVlad
    21 окт 2022 в 7:09
  • Надо что бы при изменении в дочернем файле style.css, изменения происходили и на сайте. Да. Просто я новичок в WordPress и поэтому вот пытаюсь изучать его...
    – Krenic
    21 окт 2022 в 7:34
  • Не надо менять заголовок (и тем самым вопрос) уже после того как на него дан ответ.
    – SeVlad
    21 окт 2022 в 10:38

1 ответ 1

1

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );

Откуда тут взялась my_theme_enqueue_styles?

Если ты создаёшь тему плагином (судя по коду) - либо не надо менять названия функций, либо менять их везде.

Верни как было:

add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css', 10 );
6
  • Вернул. Но всё же, как сделать так что при изменении файла style.css в дочерней теме, происходили изменения и на сайте.
    – Krenic
    21 окт 2022 в 8:06
  • @Krenic Это другой вопрос. Задавай его отдельно.
    – SeVlad
    21 окт 2022 в 10:34
  • @Krenic а этот вопрос, если решен, стоит отметить решенным.
    – SeVlad
    21 окт 2022 в 10:35
  • Простите, я просто новенький тут...
    – Krenic
    21 окт 2022 в 10:56
  • @Krenic Ничего страшного. Я тебе и подсказываю какие тут правила.
    – SeVlad
    21 окт 2022 в 11:01

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.