0

I had chosen the Airi theme for my WordPress website. I planned to make some customizations and decided to use a child theme. I had studied the WordPress documentation page https://developer.wordpress.org/themes/advanced-topics/child-themes/. I had made a folder for the child theme, put new style.css and functions.php files there. My functions.php was like this:

add_action('wp_enqueue_scripts', 'my_site_theme_enqueue_styles');
function my_site_theme_enqueue_styles()
{
    $parenthandle = 'airi-style'; 
    $theme = wp_get_theme();
    wp_enqueue_style( $parenthandle, get_template_directory_uri() . '/style.css', 
        array(),  
        $theme->parent()->get('Version')
    );
    wp_enqueue_style( 'my-site-style', get_stylesheet_uri(),
        array( $parenthandle,'airi-font-awesome' ),
        $theme->get('Version')
    );
}

Then I had activated the child theme. But the site representation wasn't the same, as it was in the parent theme. I had compared the output HTML of the child theme with the parent one and had found a 'wp-custom-css' block, that had been omitted in the child theme.

1 Answer 1

1

Additional theme styles and settings were in the Appearance - Customize menu

The Appearance - Customize menu in the admin area

I had to copy all the options from parent theme menu items and the CSS from 'Additional CSS' page to my child theme

The Appearance - Customize - Additional CSS page in the admin area

When I had done it, the site became the same as it was with the parent Airi theme.

3
  • since you have a child theme, you could enqueue the child style.css and move this custom CSS to that file if you preferred
    – Tom J Nowell
    Nov 26, 2021 at 18:18
  • Yes. But shouldn't "Additional CSS" content be updated when the parent theme is being updated? So shouldn't I make a wp_get_custom_css($parentTheme) call with the parent theme path parameter instead of copying it to the child theme? Nov 29, 2021 at 17:17
  • the additional CSS is an edge case, stored in a CPT, but in essence you would then have the problem that to change or modify that CSS you would have to switch to the parent theme to get the UI to modify it.
    – Tom J Nowell
    Nov 29, 2021 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.