WordPress Blocksy Theme Load Child Theme CSS

Child Theme

We understood that it’s recommended to use a Child Theme to add/edit the functionality of parent theme. A default Blocksy functions.php unable to load Child Theme CSS. We need to add code to load Child Theme CSS.

Default Blocksy theme’s function.php

if (! defined('WP_DEBUG')) {
	die( 'Direct access forbidden.' );
}
add_action( 'wp_enqueue_scripts', function () {
	wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
});

Updated Blocksy theme’s function.php

if (! defined('WP_DEBUG')) {
	die( 'Direct access forbidden.' );
}
add_action( 'wp_enqueue_scripts', function () {
	wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
	wp_enqueue_style( 'child-style', get_stylesheet_uri() );
});

Add replacing the code above, you may add CSS to Child Theme and able to load from front-end.

WordPress Blocksy Theme Load Child Theme CSS

Please do hesitate to contact me if you found out any mistake or typo.

What is WordPress Child Theme? Why We Need Child Theme?

WordPress Child Theme

What is WordPress Child Theme?

A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to modify, or add to, the functionality of the parent theme.

WordPress Child Theme is a WordPress theme that inherits its functionality from another WordPress theme (mostly parent theme). A child theme allows us change the functionality of the theme without edit the original theme template files. With this, we won’t be losing the ability to update the theme.

Why We Need WordPress Child Theme?

Developers like to use child theme to speed up their development. A good parent theme usually contains its own action hooks and filters. This allows developers to create a robust custom WordPress site using child theme in a short time.

Most DIY users create a child theme to tweak an existing theme without losing the ability to update the parent them if needed. They can modify the styles of elements by editing the style.css in child theme.

There are few advantages to use a WordPress Child Theme:

1. Updates
By using a child theme, users can update the parent theme safely because all of the modifications are saved in the child theme.

2. Extend
Users can add new functionality and much more by using a child theme. Users able to tweak a parent theme based on their requirement.

External Link: How to Create a Child Theme

Please do hesitate to contact me if you found out any mistake.